[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6275 - in GNUnet: . src/applications/chat src/applications
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6275 - in GNUnet: . src/applications/chat src/applications/datastore src/applications/fs/fsui src/applications/fs/gap src/applications/fs/lib src/applications/hostlist src/applications/pingpong src/applications/session src/applications/testing src/include src/setup/gtk src/setup/ncurses src/transports src/transports/upnp src/util/containers src/util/disk src/util/network |
Date: |
Wed, 13 Feb 2008 00:13:25 -0700 (MST) |
Author: grothoff
Date: 2008-02-13 00:13:25 -0700 (Wed, 13 Feb 2008)
New Revision: 6275
Modified:
GNUnet/INSTALL
GNUnet/src/applications/chat/clientapi.c
GNUnet/src/applications/datastore/prefetch.c
GNUnet/src/applications/fs/fsui/downloadtest.c
GNUnet/src/applications/fs/fsui/fsuitest.c
GNUnet/src/applications/fs/fsui/serializetest2.c
GNUnet/src/applications/fs/fsui/serializetest3.c
GNUnet/src/applications/fs/gap/fs.c
GNUnet/src/applications/fs/gap/gap.c
GNUnet/src/applications/fs/gap/plan.c
GNUnet/src/applications/fs/gap/querymanager.c
GNUnet/src/applications/fs/gap/shared.c
GNUnet/src/applications/fs/gap/test_linear_topology.c
GNUnet/src/applications/fs/gap/test_loopback.c
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/applications/hostlist/Makefile.am
GNUnet/src/applications/pingpong/pingpong.c
GNUnet/src/applications/session/cache.c
GNUnet/src/applications/session/cache.h
GNUnet/src/applications/session/connect.c
GNUnet/src/applications/testing/testing.c
GNUnet/src/include/gnunet_util_containers.h
GNUnet/src/include/gnunet_util_network.h
GNUnet/src/include/gnunet_util_threads.h
GNUnet/src/setup/gtk/ngconf.c
GNUnet/src/setup/ncurses/wizard_curs.c
GNUnet/src/transports/common.c
GNUnet/src/transports/ip.c
GNUnet/src/transports/ip.h
GNUnet/src/transports/tcp.c
GNUnet/src/transports/udp.c
GNUnet/src/transports/upnp/util.c
GNUnet/src/util/containers/bloomfilter.c
GNUnet/src/util/disk/storage.c
GNUnet/src/util/network/select.c
GNUnet/todo
Log:
format
Modified: GNUnet/INSTALL
===================================================================
--- GNUnet/INSTALL 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/INSTALL 2008-02-13 07:13:25 UTC (rev 6275)
@@ -2,7 +2,7 @@
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
+2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
@@ -67,6 +67,9 @@
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/chat/clientapi.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -161,7 +161,7 @@
{
// stop thread
// join thread
- // free room struct
+ // free room struct
GNUNET_free (chat_room->nickname);
GNUNET_free (chat_room->memberInfo);
Modified: GNUnet/src/applications/datastore/prefetch.c
===================================================================
--- GNUnet/src/applications/datastore/prefetch.c 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/datastore/prefetch.c 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -121,10 +121,11 @@
{
gather_thread = GNUNET_thread_create (&rcbAcquire, NULL, 64 * 1024);
if (gather_thread == NULL)
- GNUNET_GE_LOG_STRERROR (ectx,
- GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER
- | GNUNET_GE_IMMEDIATE, "pthread_create");
- }
+ GNUNET_GE_LOG_STRERROR (ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
+ GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
+ "pthread_create");
+ }
if (rvalue == NULL)
{
GNUNET_mutex_unlock (lock);
Modified: GNUnet/src/applications/fs/fsui/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/downloadtest.c 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/fs/fsui/downloadtest.c 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -290,8 +290,7 @@
keywords[1]);
uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
waitForEvent = GNUNET_FSUI_download_completed;
- search =
- GNUNET_FSUI_search_start (ctx, 0, uri);
+ search = GNUNET_FSUI_search_start (ctx, 0, uri);
CHECK (search != NULL);
prog = 0;
while (search != NULL)
Modified: GNUnet/src/applications/fs/fsui/fsuitest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/fs/fsui/fsuitest.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -173,8 +173,7 @@
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
uri = GNUNET_ECRS_keyword_string_to_uri (NULL, keyword);
- search =
- GNUNET_FSUI_search_start (ctx, 0, uri);
+ search = GNUNET_FSUI_search_start (ctx, 0, uri);
GNUNET_ECRS_uri_destroy (uri);
CHECK (search != NULL);
prog = 0;
Modified: GNUnet/src/applications/fs/fsui/serializetest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest2.c 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/fs/fsui/serializetest2.c 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -391,8 +391,7 @@
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
- search =
- GNUNET_FSUI_search_start (ctx, 0, uri);
+ search = GNUNET_FSUI_search_start (ctx, 0, uri);
CHECK (search != NULL);
download = GNUNET_FSUI_download_start (ctx,
0,
Modified: GNUnet/src/applications/fs/fsui/serializetest3.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest3.c 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/fs/fsui/serializetest3.c 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -163,8 +163,7 @@
GNUNET_snprintf (keyword, 40, "%s %s %s", keywords[0], _("AND"),
keywords[1]);
uri = GNUNET_ECRS_keyword_string_to_uri (ectx, keyword);
- search =
- GNUNET_FSUI_search_start (ctx, 0, uri);
+ search = GNUNET_FSUI_search_start (ctx, 0, uri);
CHECK (search != NULL);
prog = 0;
suspendRestart = 10;
Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -143,7 +143,7 @@
GNUNET_hash_to_enc (&query, &enc));
GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received REQUEST INSERT (query: `%s', type: %u, priority
%u)\n",
- &enc, ntohl(datum->type), ntohl (ri->prio));
+ &enc, ntohl (datum->type), ntohl (ri->prio));
#endif
memcpy (&datum[1],
&ri[1], ntohs (req->size) - sizeof (CS_fs_request_insert_MESSAGE));
@@ -218,11 +218,9 @@
cectx = coreAPI->cs_create_client_log_context (sock);
ri = (const CS_fs_request_index_MESSAGE *) req;
#if DEBUG_FS
- GNUNET_EC_file_block_get_query((const DBlock *) &ri[1],
- ntohs (ri->header.size) -
- sizeof
- (CS_fs_request_index_MESSAGE),
- &hc);
+ GNUNET_EC_file_block_get_query ((const DBlock *) &ri[1],
+ ntohs (ri->header.size) -
+ sizeof (CS_fs_request_index_MESSAGE), &hc);
IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&hc, &enc));
GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
@@ -468,8 +466,7 @@
IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&rs->query[0], &enc));
GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
- "FS received QUERY (query: `%s', type: %u)\n", &enc,
- type);
+ "FS received QUERY (query: `%s', type: %u)\n", &enc, type);
#endif
if (type == GNUNET_ECRS_BLOCKTYPE_DATA)
{
@@ -544,7 +541,7 @@
sender == NULL ? "localhost" : (char *) &enc);
#endif
if (stats != NULL)
- stats->change (stat_gap_query_drop_busy, 1);
+ stats->change (stat_gap_query_drop_busy, 1);
return GNUNET_OK;
}
size = ntohs (msg->size);
@@ -583,27 +580,27 @@
{
prio = -identity->changeHostTrust (sender, -prio);
if (netLoad < GAP_IDLE_LOAD_THRESHOLD + prio)
- {
- policy = GNUNET_FS_RoutingPolicy_ALL;
- }
+ {
+ policy = GNUNET_FS_RoutingPolicy_ALL;
+ }
else if (netLoad < 90 + 10 * prio)
- {
- policy =
- GNUNET_FS_RoutingPolicy_ANSWER | GNUNET_FS_RoutingPolicy_FORWARD;
- }
+ {
+ policy =
+ GNUNET_FS_RoutingPolicy_ANSWER | GNUNET_FS_RoutingPolicy_FORWARD;
+ }
else if (netLoad < 100)
- {
- policy = GNUNET_FS_RoutingPolicy_ANSWER;
- }
+ {
+ policy = GNUNET_FS_RoutingPolicy_ANSWER;
+ }
else
- {
- if (stats != NULL)
- stats->change (stat_gap_query_drop_busy, 1);
- return GNUNET_OK; /* drop */
- }
+ {
+ if (stats != NULL)
+ stats->change (stat_gap_query_drop_busy, 1);
+ return GNUNET_OK; /* drop */
+ }
}
if ((policy & GNUNET_FS_RoutingPolicy_INDIRECT) == 0)
- /* kill the priority (since we cannot benefit) */
+ /* kill the priority (since we cannot benefit) */
prio = 0;
ttl = GNUNET_FS_HELPER_bound_ttl (ntohl (req->ttl), prio);
type = ntohl (req->type);
@@ -674,12 +671,12 @@
GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* invalid! */
}
- if (stats != NULL)
+ if (stats != NULL)
{
- if (sender != NULL)
- stats->change (stat_gap_content_received, 1);
+ if (sender != NULL)
+ stats->change (stat_gap_content_received, 1);
else
- stats->change (stat_gap_content_found_locally, 1);
+ stats->change (stat_gap_content_found_locally, 1);
}
expiration = GNUNET_ntohll (msg->expiration);
/* forward to other peers */
@@ -772,7 +769,7 @@
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- GNUNET_FS_lock = capi->connection_get_lock(); // GNUNET_mutex_create
(GNUNET_YES);
+ GNUNET_FS_lock = capi->connection_get_lock (); // GNUNET_mutex_create
(GNUNET_YES);
GNUNET_FS_ANONYMITY_init (capi);
GNUNET_FS_PLAN_init (capi);
GNUNET_FS_ONDEMAND_init (capi);
Modified: GNUnet/src/applications/fs/gap/gap.c
===================================================================
--- GNUnet/src/applications/fs/gap/gap.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/fs/gap/gap.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -225,70 +225,68 @@
rl = table[index];
while (rl != NULL)
{
- if ( (rl->type == type) &&
- (rl->response_target == peer) &&
- (0 == memcmp(&rl->queries[0], queries,
- query_count * sizeof(GNUNET_HashCode))) )
- {
- if (rl->expiration > newTTL)
- {
- /* ignore */
- GNUNET_FS_PT_change_rc (peer, -1);
- GNUNET_mutex_unlock (GNUNET_FS_lock);
- if (stats != NULL)
- stats->change(stat_gap_query_dropped_redundant, 1);
- return;
- }
- if (stats != NULL)
- stats->change(stat_gap_query_refreshed, 1);
- rl->value += priority;
- rl->remaining_value += priority;
- rl->expiration = newTTL;
- rl->policy = policy;
- if ( (rl->bloomfilter_size == filter_size) &&
- (rl->bloomfilter_mutator == filter_mutator) )
- {
- if (rl->bloomfilter_size > 0)
- {
- /* update ttl / BF */
- GNUNET_bloomfilter_or(rl->bloomfilter,
- bloomfilter_data,
- filter_size);
- }
- GNUNET_FS_PT_change_rc (peer, -1);
- GNUNET_mutex_unlock (GNUNET_FS_lock);
- return;
- }
- /* update BF */
- if (rl->bloomfilter != NULL)
- GNUNET_bloomfilter_free(rl->bloomfilter);
- rl->bloomfilter_mutator = filter_mutator;
- rl->bloomfilter_size = filter_size;
- if (filter_size > 0)
- rl->bloomfilter = GNUNET_bloomfilter_init (coreAPI->ectx,
- bloomfilter_data,
- filter_size,
- GAP_BLOOMFILTER_K);
- else
- rl->bloomfilter = NULL;
- GNUNET_FS_PT_change_rc (peer, -1);
- GNUNET_mutex_unlock (GNUNET_FS_lock);
- return;
- }
- if (rl->expiration < minTTL)
- minTTL = rl->expiration;
+ if ((rl->type == type) &&
+ (rl->response_target == peer) &&
+ (0 == memcmp (&rl->queries[0], queries,
+ query_count * sizeof (GNUNET_HashCode))))
+ {
+ if (rl->expiration > newTTL)
+ {
+ /* ignore */
+ GNUNET_FS_PT_change_rc (peer, -1);
+ GNUNET_mutex_unlock (GNUNET_FS_lock);
+ if (stats != NULL)
+ stats->change (stat_gap_query_dropped_redundant, 1);
+ return;
+ }
+ if (stats != NULL)
+ stats->change (stat_gap_query_refreshed, 1);
+ rl->value += priority;
+ rl->remaining_value += priority;
+ rl->expiration = newTTL;
+ rl->policy = policy;
+ if ((rl->bloomfilter_size == filter_size) &&
+ (rl->bloomfilter_mutator == filter_mutator))
+ {
+ if (rl->bloomfilter_size > 0)
+ {
+ /* update ttl / BF */
+ GNUNET_bloomfilter_or (rl->bloomfilter,
+ bloomfilter_data, filter_size);
+ }
+ GNUNET_FS_PT_change_rc (peer, -1);
+ GNUNET_mutex_unlock (GNUNET_FS_lock);
+ return;
+ }
+ /* update BF */
+ if (rl->bloomfilter != NULL)
+ GNUNET_bloomfilter_free (rl->bloomfilter);
+ rl->bloomfilter_mutator = filter_mutator;
+ rl->bloomfilter_size = filter_size;
+ if (filter_size > 0)
+ rl->bloomfilter = GNUNET_bloomfilter_init (coreAPI->ectx,
+ bloomfilter_data,
+ filter_size,
+ GAP_BLOOMFILTER_K);
+ else
+ rl->bloomfilter = NULL;
+ GNUNET_FS_PT_change_rc (peer, -1);
+ GNUNET_mutex_unlock (GNUNET_FS_lock);
+ return;
+ }
+ if (rl->expiration < minTTL)
+ minTTL = rl->expiration;
total++;
rl = rl->next;
}
- if ( (total >= MAX_ENTRIES_PER_SLOT) &&
- (minTTL > newTTL) )
+ if ((total >= MAX_ENTRIES_PER_SLOT) && (minTTL > newTTL))
{
/* do not process */
GNUNET_FS_PT_change_rc (peer, -1);
GNUNET_mutex_unlock (GNUNET_FS_lock);
if (stats != NULL)
- stats->change(stat_gap_query_dropped, 1);
+ stats->change (stat_gap_query_dropped, 1);
return;
}
/* delete oldest table entry */
@@ -296,15 +294,15 @@
rl = table[index];
if (total >= MAX_ENTRIES_PER_SLOT)
{
- while (rl->expiration != minTTL)
- {
- prev = rl;
- rl = rl->next;
- }
+ while (rl->expiration != minTTL)
+ {
+ prev = rl;
+ rl = rl->next;
+ }
if (prev == NULL)
- table[index] = rl->next;
+ table[index] = rl->next;
else
- prev->next = rl->next;
+ prev->next = rl->next;
GNUNET_FS_SHARED_free_request_list (rl);
}
/* create new table entry */
@@ -340,12 +338,12 @@
datastore_value_processor, rl);
/* if not found or not unique, forward */
- if ( ((ret != 1) || (type != GNUNET_ECRS_BLOCKTYPE_DATA)) &&
- (0 != (policy & GNUNET_FS_RoutingPolicy_FORWARD)) )
- GNUNET_FS_PLAN_request (NULL, peer, rl);
+ if (((ret != 1) || (type != GNUNET_ECRS_BLOCKTYPE_DATA)) &&
+ (0 != (policy & GNUNET_FS_RoutingPolicy_FORWARD)))
+ GNUNET_FS_PLAN_request (NULL, peer, rl);
GNUNET_mutex_unlock (GNUNET_FS_lock);
if (stats != NULL)
- stats->change(stat_gap_query_routed, 1);
+ stats->change (stat_gap_query_routed, 1);
}
/**
@@ -407,24 +405,24 @@
BASE_REPLY_PRIORITY * (1 + rl->value),
MAX_GAP_DELAY);
GNUNET_free (msg);
- if (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
+ if (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
GNUNET_FS_SHARED_mark_response_seen (rl, &hc);
GNUNET_FS_PLAN_success (rid, NULL, rl->response_target, rl);
value += rl->value;
rl->value = 0;
- if (rl->type == GNUNET_ECRS_BLOCKTYPE_DATA)
- {
- if (prev == NULL)
- table[index] = rl->next;
- else
- prev->next = rl->next;
- GNUNET_FS_SHARED_free_request_list (rl);
- if (prev == NULL)
- rl = table[index];
- else
- rl = prev->next;
- continue;
- }
+ if (rl->type == GNUNET_ECRS_BLOCKTYPE_DATA)
+ {
+ if (prev == NULL)
+ table[index] = rl->next;
+ else
+ prev->next = rl->next;
+ GNUNET_FS_SHARED_free_request_list (rl);
+ if (prev == NULL)
+ rl = table[index];
+ else
+ rl = prev->next;
+ continue;
+ }
}
prev = rl;
rl = rl->next;
@@ -546,7 +544,8 @@
stat_gap_query_routed =
stats->create (gettext_noop ("# gap queries routed"));
stat_gap_query_refreshed =
- stats->create (gettext_noop ("# gap queries refreshed existing
record"));
+ stats->
+ create (gettext_noop ("# gap queries refreshed existing record"));
}
cron = GNUNET_cron_create (coreAPI->ectx);
GNUNET_cron_start (cron);
Modified: GNUnet/src/applications/fs/gap/plan.c
===================================================================
--- GNUnet/src/applications/fs/gap/plan.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/fs/gap/plan.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -38,7 +38,7 @@
/**
* How many entires are we allowed to plan-ahead
* per peer (at most)?
- */
+ */
#define MAX_ENTRIES_PER_PEER 64
@@ -229,7 +229,7 @@
clients = cl;
cl->client = client;
cl->peer = peer;
- GNUNET_FS_PT_change_rc(peer, 1);
+ GNUNET_FS_PT_change_rc (peer, 1);
return cl;
}
@@ -262,14 +262,14 @@
}
struct QueryPlanList *
-find_or_create_query_plan_list(PID_INDEX target)
+find_or_create_query_plan_list (PID_INDEX target)
{
struct QueryPlanList *qpl;
/* find query plan for target */
qpl = queries;
while ((qpl != NULL) && (qpl->peer != target))
- qpl = qpl->next;
+ qpl = qpl->next;
if (qpl == NULL)
{
qpl = GNUNET_malloc (sizeof (struct QueryPlanList));
@@ -283,11 +283,11 @@
}
static unsigned int
-count_query_plan_entries(struct QueryPlanList * qpl)
+count_query_plan_entries (struct QueryPlanList *qpl)
{
struct QueryPlanEntry *pos;
unsigned int total;
-
+
total = 0;
pos = qpl->head;
while (pos != NULL)
@@ -317,8 +317,8 @@
struct QueryPlanEntry *pos;
unsigned int total;
- /* find query plan for target */
- qpl = find_or_create_query_plan_list(target);
+ /* find query plan for target */
+ qpl = find_or_create_query_plan_list (target);
/* construct entry */
entry = GNUNET_malloc (sizeof (struct QueryPlanEntry));
memset (entry, 0, sizeof (struct QueryPlanEntry));
@@ -331,9 +331,9 @@
request->plan_entries = entry;
if (stats != NULL)
- stats->change(stat_gap_query_planned, 1);
+ stats->change (stat_gap_query_planned, 1);
/* compute (random) insertion position in doubly-linked list */
- total = count_query_plan_entries(qpl);
+ total = count_query_plan_entries (qpl);
total = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, total + 1);
pos = qpl->head;
while (total-- > 0)
@@ -352,9 +352,9 @@
{
entry->next = pos->next;
if (pos->next == NULL)
- qpl->tail = entry;
+ qpl->tail = entry;
else
- pos->next->prev = entry;
+ pos->next->prev = entry;
entry->prev = pos;
pos->next = entry;
}
@@ -394,11 +394,12 @@
PID_INDEX peer;
peer = GNUNET_FS_PT_intern (identity);
- if ( (peer == rpc->request->response_target) ||
- (count_query_plan_entries(find_or_create_query_plan_list(peer)) >
MAX_ENTRIES_PER_PEER) )
+ if ((peer == rpc->request->response_target) ||
+ (count_query_plan_entries (find_or_create_query_plan_list (peer)) >
+ MAX_ENTRIES_PER_PEER))
{
- GNUNET_FS_PT_change_rc(peer, -1);
- return; /* ignore! */
+ GNUNET_FS_PT_change_rc (peer, -1);
+ return; /* ignore! */
}
rank = GNUNET_malloc (sizeof (struct PeerRankings));
memset (rank, 0, sizeof (struct PeerRankings));
@@ -450,8 +451,8 @@
if (prio > allowable_prio)
prio = allowable_prio;
}
- if ( (rpc->request->response_client == NULL) &&
- (prio > rpc->request->remaining_value) )
+ if ((rpc->request->response_client == NULL) &&
+ (prio > rpc->request->remaining_value))
prio = rpc->request->remaining_value;
if (prio > 0)
{
@@ -462,23 +463,25 @@
if (rpc->request->response_client != NULL)
ttl = 0; /* initiator expiration is always "now" */
else
- {
- ttl =
- (int) (((long long) (rpc->request->expiration -
- now)) / (long long)GNUNET_CRON_SECONDS);
- }
+ {
+ ttl =
+ (int) (((long long) (rpc->request->expiration -
+ now)) / (long long) GNUNET_CRON_SECONDS);
+ }
if (ttl < 0)
- {
- ttl -= TTL_DECREMENT + GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK,
- 2 * TTL_DECREMENT);
- if (ttl > 0) /* integer underflow */
- ttl = -(1 << 30);
- }
+ {
+ ttl -=
+ TTL_DECREMENT + GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK,
+ 2 * TTL_DECREMENT);
+ if (ttl > 0) /* integer underflow */
+ ttl = -(1 << 30);
+ }
else
- {
- ttl -= TTL_DECREMENT + GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK,
- 2 * TTL_DECREMENT);
- }
+ {
+ ttl -=
+ TTL_DECREMENT + GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK,
+ 2 * TTL_DECREMENT);
+ }
}
ttl = GNUNET_FS_HELPER_bound_ttl (ttl, prio);
rank->prio = prio;
@@ -559,8 +562,8 @@
}
if (total_score == 0)
{
- GNUNET_mutex_unlock(GNUNET_FS_lock);
- return; /* no peers available */
+ GNUNET_mutex_unlock (GNUNET_FS_lock);
+ return; /* no peers available */
}
entropy = 0;
@@ -592,18 +595,20 @@
{
if (rank->score > selector)
{
- if (request->response_client == NULL)
- {
- if (rank->prio > request->remaining_value)
- {
- if ( (i == target_count - 1) ||
- (request->remaining_value == 0) )
- rank->prio = request->remaining_value;
- else
- rank->prio =
GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, request->remaining_value);
- }
- request->remaining_value -= rank->prio;
- }
+ if (request->response_client == NULL)
+ {
+ if (rank->prio > request->remaining_value)
+ {
+ if ((i == target_count - 1) ||
+ (request->remaining_value == 0))
+ rank->prio = request->remaining_value;
+ else
+ rank->prio =
+ GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK,
+ request->remaining_value);
+ }
+ request->remaining_value -= rank->prio;
+ }
add_request (rank->peer, request, rank->ttl, rank->prio);
total_score -= rank->score;
rank->score = 0; /* mark as used */
@@ -649,7 +654,7 @@
if (size > available)
return 0;
if ((prio > req->remaining_value) && (req->response_client == NULL))
- prio = req->remaining_value;
+ prio = req->remaining_value;
ttl = GNUNET_FS_HELPER_bound_ttl (ttl, prio);
msg->header.size = htons (size);
msg->header.type = htons (GNUNET_P2P_PROTO_GAP_QUERY);
@@ -659,10 +664,9 @@
msg->filter_mutator = htonl (req->bloomfilter_mutator);
msg->number_of_queries = htonl (req->key_count);
if (0 != (req->policy & GNUNET_FS_RoutingPolicy_INDIRECT))
- msg->returnTo = *coreAPI->myIdentity;
+ msg->returnTo = *coreAPI->myIdentity;
else
- GNUNET_FS_PT_resolve(req->response_target,
- &msg->returnTo);
+ GNUNET_FS_PT_resolve (req->response_target, &msg->returnTo);
memcpy (&msg->queries[0],
&req->queries[0], req->key_count * sizeof (GNUNET_HashCode));
if (req->bloomfilter != NULL)
@@ -674,7 +678,7 @@
req->last_ttl_used = ttl;
req->remaining_value -= prio;
if (stats != NULL)
- stats->change(stat_gap_query_sent, 1);
+ stats->change (stat_gap_query_sent, 1);
return size;
}
@@ -832,7 +836,7 @@
hl->response_count++;
GNUNET_mutex_unlock (GNUNET_FS_lock);
if (stats != NULL)
- stats->change(stat_gap_query_success, 1);
+ stats->change (stat_gap_query_success, 1);
}
/**
@@ -914,7 +918,7 @@
cpos = clients;
else
cpos = cprev->next;
- continue;
+ continue;
}
cprev = cpos;
cpos = cpos->next;
Modified: GNUnet/src/applications/fs/gap/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/gap/querymanager.c 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/fs/gap/querymanager.c 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -105,9 +105,9 @@
GNUNET_GE_ASSERT (NULL, key_count > 0);
if (stats != NULL)
{
- stats->change(stat_gap_client_query_tracked, 1);
- stats->change(stat_gap_client_query_received, 1);
- stats->change(stat_gap_client_query_injected, 1);
+ stats->change (stat_gap_client_query_tracked, 1);
+ stats->change (stat_gap_client_query_received, 1);
+ stats->change (stat_gap_client_query_injected, 1);
}
request =
GNUNET_malloc (sizeof (struct RequestList) +
@@ -248,7 +248,7 @@
(rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
? GNUNET_NO : GNUNET_YES);
if (stats != NULL)
- stats->change(stat_gap_client_response_sent, 1);
+ stats->change (stat_gap_client_response_sent, 1);
GNUNET_free (msg);
/* update *value */
@@ -337,8 +337,8 @@
else
cl->requests = rl->next;
GNUNET_FS_SHARED_free_request_list (rl);
- if (stats != NULL)
- stats->change(stat_gap_client_query_tracked, -1);
+ if (stats != NULL)
+ stats->change (stat_gap_client_query_tracked, -1);
if (prev == NULL)
rl = cl->requests;
else
@@ -384,8 +384,8 @@
rl = cl->requests;
cl->requests = rl->next;
GNUNET_FS_SHARED_free_request_list (rl);
- if (stats != NULL)
- stats->change(stat_gap_client_query_tracked, -1);
+ if (stats != NULL)
+ stats->change (stat_gap_client_query_tracked, -1);
}
if (prev == NULL)
clients = cl->next;
@@ -420,11 +420,11 @@
(request->expiration > now)) &&
(request->last_ttl_used * GNUNET_CRON_SECONDS +
request->last_request_time < now))
- {
- GNUNET_FS_PLAN_request (client->client, 0, request);
- if (stats != NULL)
- stats->change(stat_gap_client_query_injected, 1);
- }
+ {
+ GNUNET_FS_PLAN_request (client->client, 0, request);
+ if (stats != NULL)
+ stats->change (stat_gap_client_query_injected, 1);
+ }
if ((request->anonymityLevel == 0) &&
(request->last_dht_get + request->dht_back_off < now))
@@ -478,7 +478,7 @@
coreAPI->
cs_exit_handler_unregister (&handle_client_exit));
while (clients != NULL)
- handle_client_exit(clients->client);
+ handle_client_exit (clients->client);
if (stats != NULL)
{
coreAPI->release_service (stats);
Modified: GNUnet/src/applications/fs/gap/shared.c
===================================================================
--- GNUnet/src/applications/fs/gap/shared.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/fs/gap/shared.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -64,7 +64,7 @@
GNUNET_bloomfilter_free (rl->bloomfilter);
GNUNET_FS_PT_change_rc (rl->primary_target, -1);
GNUNET_FS_PT_change_rc (rl->response_target, -1);
- memset(rl, 0, sizeof(struct RequestList)); /* mark as freed */
+ memset (rl, 0, sizeof (struct RequestList)); /* mark as freed */
GNUNET_free (rl);
}
@@ -91,33 +91,33 @@
int ret;
/* check that type and primary key match */
- if ( ( (rl->type != GNUNET_ECRS_BLOCKTYPE_ANY) &&
- (rl->type != ntohl (data->type)) ) ||
+ if (((rl->type != GNUNET_ECRS_BLOCKTYPE_ANY) &&
+ (rl->type != ntohl (data->type))) ||
(0 != memcmp (primary_key, &rl->queries[0], sizeof (GNUNET_HashCode))))
- return GNUNET_NO;
+ return GNUNET_NO;
/* check that content matches query */
- ret = GNUNET_EC_is_block_applicable_for_query (ntohl(data->type),
+ ret = GNUNET_EC_is_block_applicable_for_query (ntohl (data->type),
size,
data,
&rl->queries[0],
rl->key_count,
&rl->queries[0]);
if (ret != GNUNET_OK)
- return ret;
+ return ret;
/* check that this is a new response */
GNUNET_hash (data, size, hc);
GNUNET_FS_HELPER_mingle_hash (hc, rl->bloomfilter_mutator, &m);
if ((rl->bloomfilter != NULL) &&
(GNUNET_YES == GNUNET_bloomfilter_test (rl->bloomfilter, &m)))
- return GNUNET_NO; /* not useful */
+ return GNUNET_NO; /* not useful */
/* bloomfilter should cover these already */
seen = rl->responses;
while (seen != NULL)
{
if (0 == memcmp (hc, &seen->hash, sizeof (GNUNET_HashCode)))
- return GNUNET_NO;
+ return GNUNET_NO;
seen = seen->next;
}
return GNUNET_OK;
@@ -135,9 +135,7 @@
struct ResponseList *seen;
GNUNET_HashCode m;
- GNUNET_FS_HELPER_mingle_hash (hc,
- rl->bloomfilter_mutator,
- &m);
+ GNUNET_FS_HELPER_mingle_hash (hc, rl->bloomfilter_mutator, &m);
GNUNET_bloomfilter_add (rl->bloomfilter, &m);
/* update seen list */
seen = GNUNET_malloc (sizeof (struct ResponseList));
Modified: GNUnet/src/applications/fs/gap/test_linear_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-02-13
07:00:17 UTC (rev 6274)
+++ GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-02-13
07:13:25 UTC (rev 6275)
@@ -170,9 +170,7 @@
myURI = NULL;
ret = GNUNET_ECRS_search (ectx,
cfg,
- *uri,
- 1,
- &searchCB, &myURI, &testTerminate, NULL);
+ *uri, 1, &searchCB, &myURI, &testTerminate, NULL);
GNUNET_ECRS_uri_destroy (*uri);
*uri = myURI;
if ((ret != GNUNET_SYSERR) && (myURI != NULL))
@@ -198,7 +196,7 @@
"Starting download of `%s'\n", tmp);
GNUNET_free (tmp);
tmpName = makeName (0);
- unlink(tmpName);
+ unlink (tmpName);
ret = GNUNET_SYSERR;
if (GNUNET_OK == GNUNET_ECRS_file_download (ectx,
cfg,
@@ -238,7 +236,7 @@
name = makeName (size);
ret =
GNUNET_ECRS_file_unindex (ectx, cfg, name, NULL, NULL, &testTerminate,
- NULL);
+ NULL);
if (0 != UNLINK (name))
ret = GNUNET_SYSERR;
GNUNET_free (name);
@@ -304,7 +302,8 @@
printf ("Downloading...\n");
CHECK (GNUNET_OK == downloadFile (SIZE, uri));
printf ("Download successful at %llu kbps!\n",
- (SIZE * GNUNET_CRON_SECONDS/ 1024) / ((1 + GNUNET_get_time () -
start)));
+ (SIZE * GNUNET_CRON_SECONDS / 1024) /
+ ((1 + GNUNET_get_time () - start)));
GNUNET_ECRS_uri_destroy (uri);
GNUNET_GC_set_configuration_value_string (cfg,
ectx,
Modified: GNUnet/src/applications/fs/gap/test_loopback.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_loopback.c 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/fs/gap/test_loopback.c 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -166,9 +166,7 @@
myURI = NULL;
ret = GNUNET_ECRS_search (ectx,
cfg,
- *uri,
- 0,
- &searchCB, &myURI, &testTerminate, NULL);
+ *uri, 0, &searchCB, &myURI, &testTerminate, NULL);
GNUNET_ECRS_uri_destroy (*uri);
*uri = myURI;
if ((ret != GNUNET_SYSERR) && (myURI != NULL))
@@ -233,7 +231,7 @@
name = makeName (size);
ret =
GNUNET_ECRS_file_unindex (ectx, cfg, name, NULL, NULL, &testTerminate,
- NULL);
+ NULL);
if (0 != UNLINK (name))
ret = GNUNET_SYSERR;
GNUNET_free (name);
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/fs/lib/fslib.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -160,8 +160,7 @@
if (GNUNET_OK == GNUNET_client_connection_read (ctx->sock, &hdr))
{
#if DEBUG_FSLIB
- fprintf(stderr,
- "FSLIB: received message from gnunetd\n");
+ fprintf (stderr, "FSLIB: received message from gnunetd\n");
#endif
delay = 100 * GNUNET_CRON_MILLISECONDS;
/* verify hdr, if reply, process, otherwise
@@ -194,7 +193,7 @@
value->prio = htonl (0);
value->anonymityLevel = rep->anonymityLevel;
value->expirationTime = rep->expirationTime;
- memcpy (&value[1], &rep[1], size);
+ memcpy (&value[1], &rep[1], size);
matched = 0;
GNUNET_mutex_lock (ctx->lock);
prev = NULL;
@@ -224,10 +223,9 @@
pos = pos->next;
}
#if DEBUG_FSLIB
- fprintf(stderr,
- "FSLIB passes response %u to client (%d)\n",
- ctx->total_received++,
- unique);
+ fprintf (stderr,
+ "FSLIB passes response %u to client (%d)\n",
+ ctx->total_received++, unique);
#endif
if ((spos->callback != NULL) &&
(GNUNET_SYSERR == spos->callback (&query,
@@ -246,8 +244,8 @@
GNUNET_free (value);
#if DEBUG_FSLIB
if (matched == 0)
- fprintf(stderr,
- "FSLIB: received content but have no pending request\n");
+ fprintf (stderr,
+ "FSLIB: received content but have no pending request\n");
#endif
GNUNET_mutex_unlock (ctx->lock);
}
@@ -279,7 +277,7 @@
GNUNET_GE_ASSERT (ectx, lock != NULL);
ret = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchContext));
- memset(ret, 0, sizeof (struct GNUNET_FS_SearchContext));
+ memset (ret, 0, sizeof (struct GNUNET_FS_SearchContext));
ret->ectx = ectx;
ret->cfg = cfg;
ret->lock = lock;
@@ -354,10 +352,7 @@
req = (CS_fs_request_search_MESSAGE *) & ret[1];
#if DEBUG_FSLIB
GNUNET_hash_to_enc (keys, &enc);
- fprintf(stderr,
- "FSLIB: start search for `%s' (%p)\n",
- (char*) &enc,
- ret);
+ fprintf (stderr, "FSLIB: start search for `%s' (%p)\n", (char *) &enc, ret);
#endif
req->header.size =
htons (sizeof (CS_fs_request_search_MESSAGE) +
@@ -376,10 +371,9 @@
ret->next = ctx->handles;
ctx->handles = ret;
#if DEBUG_FSLIB
- fprintf(stderr,
- "FSLIB passes request %u to daemon (%d)\n",
- ctx->total_requested++,
- type);
+ fprintf (stderr,
+ "FSLIB passes request %u to daemon (%d)\n",
+ ctx->total_requested++, type);
#endif
ok = GNUNET_client_connection_write (ctx->sock, &req->header);
GNUNET_mutex_unlock (ctx->lock);
@@ -459,8 +453,7 @@
memcpy (&ri[1], fn, strlen (fn));
#if DEBUG_FSLIB
- fprintf(stderr,
- "Sending index initialization request to gnunetd\n");
+ fprintf (stderr, "Sending index initialization request to gnunetd\n");
#endif
if (GNUNET_OK != GNUNET_client_connection_write (sock, &ri->header))
{
@@ -469,8 +462,8 @@
}
GNUNET_free (ri);
#if DEBUG_FSLIB
- fprintf(stderr,
- "Waiting for confirmation of index initialization request by
gnunetd\n");
+ fprintf (stderr,
+ "Waiting for confirmation of index initialization request by
gnunetd\n");
#endif
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
return GNUNET_SYSERR;
@@ -511,13 +504,11 @@
ri->fileOffset = GNUNET_htonll (offset);
memcpy (&ri[1], &block[1], size);
#if DEBUG_FSLIB
- GNUNET_EC_file_block_get_query((const DBlock *) &block[1],
- size,
- &hc);
+ GNUNET_EC_file_block_get_query ((const DBlock *) &block[1], size, &hc);
GNUNET_hash_to_enc (&hc, &enc);
- fprintf(stderr,
- "Sending index request for `%s' to gnunetd)\n",
- (const char*) &enc);
+ fprintf (stderr,
+ "Sending index request for `%s' to gnunetd)\n",
+ (const char *) &enc);
#endif
retry = AUTO_RETRY;
do
@@ -528,8 +519,8 @@
return GNUNET_SYSERR;
}
#if DEBUG_FSLIB
- fprintf(stderr,
- "Waiting for confirmation of index request by gnunetd\n");
+ fprintf (stderr,
+ "Waiting for confirmation of index request by gnunetd\n");
#endif
if (GNUNET_OK != GNUNET_client_connection_read_result (sock, &ret))
{
Modified: GNUnet/src/applications/hostlist/Makefile.am
===================================================================
--- GNUnet/src/applications/hostlist/Makefile.am 2008-02-13 07:00:17 UTC
(rev 6274)
+++ GNUnet/src/applications/hostlist/Makefile.am 2008-02-13 07:13:25 UTC
(rev 6275)
@@ -12,7 +12,7 @@
libgnunetmodule_hostlist_la_SOURCES = \
hostlist.c
libgnunetmodule_hostlist_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/util/libgnunetutil.la -lmicrohttpd
libgnunetmodule_hostlist_la_LDFLAGS = \
-export-dynamic -avoid-version -module
Modified: GNUnet/src/applications/pingpong/pingpong.c
===================================================================
--- GNUnet/src/applications/pingpong/pingpong.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/pingpong/pingpong.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -214,7 +214,7 @@
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_ADMIN,
_("Received PING from `%s' not destined for us!\n"),
- &enc);
+ &enc);
GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR; /* not for us */
}
Modified: GNUnet/src/applications/session/cache.c
===================================================================
--- GNUnet/src/applications/session/cache.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/session/cache.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -23,7 +23,7 @@
* @brief module responsible for caching
* sessionkey exchange requests
* @author Christian Grothoff
- *
+ *
* TODO: add code to evict very old entries from the cache!
*/
#include "platform.h"
@@ -31,9 +31,10 @@
#define MAX_CACHE_ENTRIES 8
-struct Entry {
- struct Entry * next;
- GNUNET_MessageHeader * msg;
+struct Entry
+{
+ struct Entry *next;
+ GNUNET_MessageHeader *msg;
GNUNET_PeerIdentity peer;
GNUNET_AES_SessionKey key;
GNUNET_Int32Time time_limit;
@@ -41,23 +42,23 @@
static unsigned int count;
-static struct Entry * cache;
+static struct Entry *cache;
-static struct GNUNET_Mutex * lock;
+static struct GNUNET_Mutex *lock;
static void
-expire_oldest_entries()
+expire_oldest_entries ()
{
- struct Entry * e;
- struct Entry * prev;
+ struct Entry *e;
+ struct Entry *prev;
GNUNET_Int32Time oldest;
- oldest = -1; /* infinity */
+ oldest = -1; /* infinity */
e = cache;
while (e != NULL)
{
if (e->time_limit < oldest)
- oldest = e->time_limit;
+ oldest = e->time_limit;
e = e->next;
}
e = cache;
@@ -65,16 +66,16 @@
while (e != NULL)
{
if (e->time_limit == oldest)
- {
- if (prev == NULL)
- cache = e->next;
- else
- prev->next = e->next;
- GNUNET_free(e->msg);
- GNUNET_free(e);
- count--;
- return;
- }
+ {
+ if (prev == NULL)
+ cache = e->next;
+ else
+ prev->next = e->next;
+ GNUNET_free (e->msg);
+ GNUNET_free (e);
+ count--;
+ return;
+ }
prev = e;
e = e->next;
}
@@ -89,37 +90,33 @@
* @return GNUNET_OK on success
*/
int
-GNUNET_session_cache_get(const GNUNET_PeerIdentity * peer,
- GNUNET_Int32Time time_limit,
- const GNUNET_AES_SessionKey * key,
- unsigned short size,
- GNUNET_MessageHeader ** msg)
+GNUNET_session_cache_get (const GNUNET_PeerIdentity * peer,
+ GNUNET_Int32Time time_limit,
+ const GNUNET_AES_SessionKey * key,
+ unsigned short size, GNUNET_MessageHeader ** msg)
{
- struct Entry * e;
+ struct Entry *e;
- GNUNET_mutex_lock(lock);
+ GNUNET_mutex_lock (lock);
e = cache;
while (e != NULL)
{
- if ( (0 == memcmp(&e->peer,
- peer,
- sizeof(GNUNET_PeerIdentity))) &&
- (0 == memcmp(&e->key,
- key,
- sizeof(GNUNET_AES_SessionKey))) &&
- (e->time_limit == time_limit) &&
- (ntohs(e->msg->size) == size) )
- {
- *msg = GNUNET_malloc(ntohs(e->msg->size));
- memcpy(*msg,
- e->msg,
- ntohs(e->msg->size));
- GNUNET_mutex_unlock(lock);
- return GNUNET_OK;
- }
+ if ((0 == memcmp (&e->peer,
+ peer,
+ sizeof (GNUNET_PeerIdentity))) &&
+ (0 == memcmp (&e->key,
+ key,
+ sizeof (GNUNET_AES_SessionKey))) &&
+ (e->time_limit == time_limit) && (ntohs (e->msg->size) == size))
+ {
+ *msg = GNUNET_malloc (ntohs (e->msg->size));
+ memcpy (*msg, e->msg, ntohs (e->msg->size));
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_OK;
+ }
e = e->next;
- }
- GNUNET_mutex_unlock(lock);
+ }
+ GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -131,42 +128,38 @@
* @return GNUNET_OK on success
*/
void
-GNUNET_session_cache_put(const GNUNET_PeerIdentity * peer,
- GNUNET_Int32Time time_limit,
- const GNUNET_AES_SessionKey * key,
- const GNUNET_MessageHeader * msg)
+GNUNET_session_cache_put (const GNUNET_PeerIdentity * peer,
+ GNUNET_Int32Time time_limit,
+ const GNUNET_AES_SessionKey * key,
+ const GNUNET_MessageHeader * msg)
{
- struct Entry * e;
+ struct Entry *e;
- GNUNET_mutex_lock(lock);
+ GNUNET_mutex_lock (lock);
e = cache;
while (e != NULL)
{
- if (0 == memcmp(&e->peer,
- peer,
- sizeof(GNUNET_PeerIdentity)))
- break;
+ if (0 == memcmp (&e->peer, peer, sizeof (GNUNET_PeerIdentity)))
+ break;
e = e->next;
}
if (e == NULL)
{
- e = GNUNET_malloc(sizeof(struct Entry));
+ e = GNUNET_malloc (sizeof (struct Entry));
e->msg = NULL;
e->peer = *peer;
e->next = cache;
cache = e;
count++;
}
- GNUNET_free_non_null(e->msg);
+ GNUNET_free_non_null (e->msg);
e->key = *key;
e->time_limit = time_limit;
- e->msg = GNUNET_malloc(ntohs(msg->size));
- memcpy(e->msg,
- msg,
- ntohs(msg->size));
+ e->msg = GNUNET_malloc (ntohs (msg->size));
+ memcpy (e->msg, msg, ntohs (msg->size));
if (count > MAX_CACHE_ENTRIES)
- expire_oldest_entries();
- GNUNET_mutex_unlock(lock);
+ expire_oldest_entries ();
+ GNUNET_mutex_unlock (lock);
}
void __attribute__ ((constructor)) GNUNET_session_cache_ltdl_init ()
@@ -176,13 +169,13 @@
void __attribute__ ((destructor)) GNUNET_session_cache_ltdl_fini ()
{
- struct Entry * e;
+ struct Entry *e;
while (cache != NULL)
{
e = cache;
cache = e->next;
- GNUNET_free(e->msg);
- GNUNET_free(e);
+ GNUNET_free (e->msg);
+ GNUNET_free (e);
}
GNUNET_mutex_destroy (lock);
lock = NULL;
Modified: GNUnet/src/applications/session/cache.h
===================================================================
--- GNUnet/src/applications/session/cache.h 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/session/cache.h 2008-02-13 07:13:25 UTC (rev
6275)
@@ -38,11 +38,10 @@
* @return GNUNET_OK on success
*/
int
-GNUNET_session_cache_get(const GNUNET_PeerIdentity * peer,
- GNUNET_Int32Time time_limit,
- const GNUNET_AES_SessionKey * key,
- unsigned short size,
- GNUNET_MessageHeader ** msg);
+GNUNET_session_cache_get (const GNUNET_PeerIdentity * peer,
+ GNUNET_Int32Time time_limit,
+ const GNUNET_AES_SessionKey * key,
+ unsigned short size, GNUNET_MessageHeader ** msg);
/**
* Store a message in the cache.
@@ -52,9 +51,9 @@
* @return GNUNET_OK on success
*/
void
-GNUNET_session_cache_put(const GNUNET_PeerIdentity * peer,
- GNUNET_Int32Time time_limit,
- const GNUNET_AES_SessionKey * key,
- const GNUNET_MessageHeader * msg);
+GNUNET_session_cache_put (const GNUNET_PeerIdentity * peer,
+ GNUNET_Int32Time time_limit,
+ const GNUNET_AES_SessionKey * key,
+ const GNUNET_MessageHeader * msg);
#endif
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/session/connect.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -55,7 +55,7 @@
static GNUNET_Stats_ServiceAPI *stats;
-static struct GNUNET_Mutex * lock;
+static struct GNUNET_Mutex *lock;
static struct GNUNET_GE_Context *ectx;
@@ -166,9 +166,9 @@
* connections are disallowed
*/
static int
-verifySKS (const GNUNET_PeerIdentity * hostId,
- const P2P_setkey_MESSAGE * sks) {
- const GNUNET_RSA_Signature * signature = &sks->signature;
+verifySKS (const GNUNET_PeerIdentity * hostId, const P2P_setkey_MESSAGE * sks)
+{
+ const GNUNET_RSA_Signature *signature = &sks->signature;
char *limited;
GNUNET_EncName enc;
@@ -221,7 +221,10 @@
GNUNET_free (limited);
if (GNUNET_OK != identity->verifyPeerSignature (hostId,
sks,
- sizeof(P2P_setkey_MESSAGE) -
sizeof(GNUNET_RSA_Signature),
+ sizeof (P2P_setkey_MESSAGE)
+ -
+ sizeof
+ (GNUNET_RSA_Signature),
signature))
{
#if DEBUG_SESSION
@@ -306,49 +309,43 @@
size += ntohs (ping->size);
if (pong != NULL)
size += ntohs (pong->size);
-
+
if (GNUNET_OK !=
- GNUNET_session_cache_get(&hc,
- created,
- sk,
- size,
- (GNUNET_MessageHeader**)&msg))
+ GNUNET_session_cache_get (&hc,
+ created,
+ sk, size, (GNUNET_MessageHeader **) & msg))
{
msg = GNUNET_malloc (size);
msg->target = *hostId;
if (GNUNET_SYSERR == GNUNET_RSA_encrypt (sk,
- sizeof (GNUNET_AES_SessionKey),
- &foreignHello->publicKey,
- &msg->key))
- {
- GNUNET_GE_BREAK_OP (ectx, 0);
- GNUNET_free (foreignHello);
- GNUNET_free (msg);
- return NULL; /* encrypt failed */
- }
+ sizeof (GNUNET_AES_SessionKey),
+ &foreignHello->publicKey,
+ &msg->key))
+ {
+ GNUNET_GE_BREAK_OP (ectx, 0);
+ GNUNET_free (foreignHello);
+ GNUNET_free (msg);
+ return NULL; /* encrypt failed */
+ }
/* complete header */
msg->header.size = htons (size);
msg->header.type = htons (GNUNET_P2P_PROTO_SET_KEY);
msg->creationTime = htonl (created);
GNUNET_GE_ASSERT (ectx,
- GNUNET_SYSERR !=
- identity->signData (msg,
- sizeof (P2P_setkey_MESSAGE)
- - sizeof (GNUNET_RSA_Signature),
- &msg->signature));
- GNUNET_session_cache_put(&hc,
- created,
- sk,
- &msg->header);
+ GNUNET_SYSERR !=
+ identity->signData (msg,
+ sizeof (P2P_setkey_MESSAGE)
+ - sizeof (GNUNET_RSA_Signature),
+ &msg->signature));
+ GNUNET_session_cache_put (&hc, created, sk, &msg->header);
}
GNUNET_free (foreignHello);
#if EXTRA_CHECKS
/* verify signature/SKS */
GNUNET_GE_ASSERT (ectx,
- GNUNET_SYSERR != verifySKS (coreAPI->myIdentity,
- msg));
+ GNUNET_SYSERR != verifySKS (coreAPI->myIdentity, msg));
#endif
size = 0;
@@ -375,9 +372,9 @@
GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Encrypting %d bytes of %s%s with key %s and IV %u\n",
size,
- (ping == NULL) ? "" : "PING",
- (pong == NULL) ? "" : "PONG",
- printSKEY (sk), *(int *) &msg->signature);
+ (ping == NULL) ? "" : "PING",
+ (pong == NULL) ? "" : "PONG",
+ printSKEY (sk), *(int *) &msg->signature);
#endif
GNUNET_GE_ASSERT (ectx,
-1 != GNUNET_AES_encrypt (pt,
@@ -451,7 +448,7 @@
}
/* get or create our session key */
- GNUNET_mutex_lock(lock);
+ GNUNET_mutex_lock (lock);
if (GNUNET_OK !=
coreAPI->connection_get_session_key_of_peer (receiver, &sk,
&age, GNUNET_YES))
@@ -459,7 +456,7 @@
age = GNUNET_get_time_int32 (NULL);
GNUNET_AES_create_session_key (&sk);
coreAPI->connection_assign_session_key_to_peer (&sk, receiver,
- age, GNUNET_YES);
+ age, GNUNET_YES);
#if DEBUG_SESSION
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
@@ -467,7 +464,7 @@
printSKEY (&sk), &enc);
#endif
}
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
/* build SKEY message */
skey = makeSessionKeySigned (receiver, &sk, age, ping, pong);
@@ -591,12 +588,12 @@
"Received session key from peer `%s'.\n", &enc);
#endif
- if ( (ntohs (msg->size) < sizeof (P2P_setkey_MESSAGE)) ||
- (! ( ((ntohs (msg->size) == sizeof (P2P_setkey_MESSAGE)) ||
- (ntohs (msg->size) ==
- sizeof (P2P_setkey_MESSAGE) + pingpong->ping_size)
- || (ntohs (msg->size) ==
- sizeof (P2P_setkey_MESSAGE) + pingpong->ping_size * 2)) )) )
+ if ((ntohs (msg->size) < sizeof (P2P_setkey_MESSAGE)) ||
+ (!(((ntohs (msg->size) == sizeof (P2P_setkey_MESSAGE)) ||
+ (ntohs (msg->size) ==
+ sizeof (P2P_setkey_MESSAGE) + pingpong->ping_size)
+ || (ntohs (msg->size) ==
+ sizeof (P2P_setkey_MESSAGE) + pingpong->ping_size * 2)))))
{
GNUNET_GE_LOG (ectx,
GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER | GNUNET_GE_USER
@@ -606,7 +603,7 @@
&enc);
return GNUNET_SYSERR;
}
- GNUNET_mutex_lock(lock);
+ GNUNET_mutex_lock (lock);
if ((GNUNET_OK !=
coreAPI->connection_get_session_key_of_peer (sender, NULL,
NULL,
@@ -618,28 +615,29 @@
{
#if DEBUG_SESSION
GNUNET_GE_LOG (ectx,
- GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
- "Received session key from peer `%s', but that peer is not
allowed to connect right now!\n", &enc);
-#endif
- GNUNET_mutex_unlock(lock);
- return GNUNET_SYSERR; /* other peer initiated but is
- listed as not allowed => discard */
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
+ "Received session key from peer `%s', but that peer is
not allowed to connect right now!\n",
+ &enc);
+#endif
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_SYSERR; /* other peer initiated but is
+ listed as not allowed => discard */
}
newMsg = (const P2P_setkey_MESSAGE *) msg;
if (0 != memcmp (&coreAPI->myIdentity->hashPubKey,
- &newMsg->target.hashPubKey, sizeof (GNUNET_HashCode)))
+ &newMsg->target.hashPubKey, sizeof (GNUNET_HashCode)))
{
GNUNET_EncName ta;
GNUNET_hash_to_enc (&newMsg->target.hashPubKey, &ta);
GNUNET_GE_LOG (ectx,
- GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER |
- GNUNET_GE_USER | GNUNET_GE_BULK,
- _
- ("Session key received from peer `%s' is for `%s' and not
for me!\n"),
- &enc, &ta);
- GNUNET_mutex_unlock(lock);
- return GNUNET_SYSERR; /* not for us! */
+ GNUNET_GE_WARNING | GNUNET_GE_DEVELOPER |
+ GNUNET_GE_USER | GNUNET_GE_BULK,
+ _
+ ("Session key received from peer `%s' is for `%s' and not
for me!\n"),
+ &enc, &ta);
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_SYSERR; /* not for us! */
}
ret = verifySKS (sender, newMsg);
if (GNUNET_OK != ret)
@@ -654,7 +652,7 @@
#endif
if (stats != NULL)
stats->change (stat_skeyRejected, 1);
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR; /* rejected */
}
memset (&key, 0, sizeof (GNUNET_AES_SessionKey));
@@ -667,7 +665,7 @@
| GNUNET_GE_BULK,
_("Invalid `%s' message received from peer `%s'.\n"),
"setkey", &enc);
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
if (key.crc32 != htonl (GNUNET_crc32_n (&key, GNUNET_SESSIONKEY_LEN)))
@@ -683,7 +681,7 @@
#endif
GNUNET_GE_BREAK_OP (ectx, 0);
stats->change (stat_skeyRejected, 1);
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -691,8 +689,7 @@
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
"Received setkey message from `%s' with %u bytes of data and
key `%s'.\n",
- &enc, ntohs (newMsg->header.size),
- printSKEY (&key));
+ &enc, ntohs (newMsg->header.size), printSKEY (&key));
#endif
if (stats != NULL)
stats->change (stat_skeyAccepted, 1);
@@ -809,7 +806,7 @@
}
}
GNUNET_free_non_null (plaintext);
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
@@ -859,7 +856,7 @@
#endif
return GNUNET_NO; /* not allowed right now! */
}
- GNUNET_mutex_lock(lock);
+ GNUNET_mutex_lock (lock);
#if DEBUG_SESSION
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
@@ -867,10 +864,10 @@
#endif
if (GNUNET_OK == exchangeKey (peer, NULL, NULL))
{
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
return GNUNET_NO;
}
- GNUNET_mutex_unlock(lock);
+ GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -938,7 +935,7 @@
stat_pongSent
= stats->create (gettext_noop ("# encrypted PONG messages sent"));
}
- lock = GNUNET_mutex_create(GNUNET_YES);
+ lock = GNUNET_mutex_create (GNUNET_YES);
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_
@@ -976,7 +973,7 @@
coreAPI->release_service (pingpong);
pingpong = NULL;
coreAPI = NULL;
- GNUNET_mutex_destroy(lock);
+ GNUNET_mutex_destroy (lock);
lock = NULL;
return GNUNET_OK;
}
Modified: GNUnet/src/applications/testing/testing.c
===================================================================
--- GNUnet/src/applications/testing/testing.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/applications/testing/testing.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -283,8 +283,8 @@
senderIdentity))
{
ret = GNUNET_OK;
- GNUNET_free_non_null (h1);
- GNUNET_free_non_null (h2);
+ GNUNET_free_non_null (h1);
+ GNUNET_free_non_null (h2);
break;
}
if (GNUNET_YES == GNUNET_IDENTITY_request_connect (sock2,
@@ -292,8 +292,8 @@
senderIdentity))
{
ret = GNUNET_OK;
- GNUNET_free_non_null (h1);
- GNUNET_free_non_null (h2);
+ GNUNET_free_non_null (h1);
+ GNUNET_free_non_null (h2);
break;
}
GNUNET_thread_sleep (100 * GNUNET_CRON_MILLISECONDS);
Modified: GNUnet/src/include/gnunet_util_containers.h
===================================================================
--- GNUnet/src/include/gnunet_util_containers.h 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/include/gnunet_util_containers.h 2008-02-13 07:13:25 UTC (rev
6275)
@@ -155,8 +155,7 @@
* @param bf the filter
*/
int GNUNET_bloomfilter_or (struct GNUNET_BloomFilter *bf,
- const char * data,
- unsigned int size);
+ const char *data, unsigned int size);
/**
* Resize a bloom filter. Note that this operation
Modified: GNUnet/src/include/gnunet_util_network.h
===================================================================
--- GNUnet/src/include/gnunet_util_network.h 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/include/gnunet_util_network.h 2008-02-13 07:13:25 UTC (rev
6275)
@@ -265,13 +265,12 @@
* @param routeList a string specifying the forbidden networks
* @return the converted list, NULL if the syntax is flawed
*/
-struct GNUNET_IPv4NetworkSet *
-GNUNET_parse_ipv4_network_specification (struct
- GNUNET_GE_Context
- *ectx,
- const
- char
- *routeList);
+struct GNUNET_IPv4NetworkSet *GNUNET_parse_ipv4_network_specification (struct
+
GNUNET_GE_Context
+ *ectx,
+ const
+ char
+
*routeList);
/**
* Parse a network specification. The argument specifies
@@ -284,13 +283,12 @@
* @param routeList a string specifying the forbidden networks
* @return the converted list, NULL if the syntax is flawed
*/
-struct GNUNET_IPv6NetworkSet *
-GNUNET_parse_ipv6_network_specification (struct
- GNUNET_GE_Context
- *ectx,
- const
- char
- *routeList);
+struct GNUNET_IPv6NetworkSet *GNUNET_parse_ipv6_network_specification (struct
+
GNUNET_GE_Context
+ *ectx,
+ const
+ char
+
*routeList);
/**
* Check if the given IP address is in the list of
@@ -332,11 +330,10 @@
* The OS socket should henceforth be no longer used
* directly. GNUNET_socket_destroy will close it.
*/
-struct GNUNET_SocketHandle *
-GNUNET_socket_create (struct GNUNET_GE_Context
- *ectx,
- struct GNUNET_LoadMonitor
- *mon, int osSocket);
+struct GNUNET_SocketHandle *GNUNET_socket_create (struct GNUNET_GE_Context
+ *ectx,
+ struct GNUNET_LoadMonitor
+ *mon, int osSocket);
/**
* Close the socket (does NOT destroy it)
@@ -431,7 +428,7 @@
* connections accepted on the given socket
* @param timeout after how long should inactive connections be
* closed? Use 0 for no timeout. The specified timeout
- * will be the default for all new connections;
+ * will be the default for all new connections;
* after (!) returning (!) from the accept handler,
* clients can change the timeout of an individual
* socket using GNUNET_select_change_timeout.
@@ -442,23 +439,22 @@
* accept at most? 0 for unbounded
* @return NULL on error
*/
-struct GNUNET_SelectHandle *
-GNUNET_select_create (const char *desc,
- int is_udp,
- struct GNUNET_GE_Context
- *ectx,
- struct GNUNET_LoadMonitor
- *mon, int sock,
- unsigned int max_addr_len,
- GNUNET_CronTime timeout,
- GNUNET_SelectMessageHandler
- mh, void *mh_cls,
- GNUNET_SelectAcceptHandler
- ah, void *ah_cls,
- GNUNET_SelectCloseHandler
- ch, void *ch_cls,
- unsigned int memory_quota,
- int socket_quota);
+struct GNUNET_SelectHandle *GNUNET_select_create (const char *desc,
+ int is_udp,
+ struct GNUNET_GE_Context
+ *ectx,
+ struct GNUNET_LoadMonitor
+ *mon, int sock,
+ unsigned int max_addr_len,
+ GNUNET_CronTime timeout,
+ GNUNET_SelectMessageHandler
+ mh, void *mh_cls,
+ GNUNET_SelectAcceptHandler
+ ah, void *ah_cls,
+ GNUNET_SelectCloseHandler
+ ch, void *ch_cls,
+ unsigned int memory_quota,
+ int socket_quota);
/**
* Terminate the select thread, close the socket and
Modified: GNUnet/src/include/gnunet_util_threads.h
===================================================================
--- GNUnet/src/include/gnunet_util_threads.h 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/include/gnunet_util_threads.h 2008-02-13 07:13:25 UTC (rev
6275)
@@ -112,10 +112,9 @@
* will just segfault and gdb will give a messed-up stacktrace.
* @return the handle
*/
-struct GNUNET_ThreadHandle *
-GNUNET_thread_create (GNUNET_ThreadMainFunction
- main, void *arg,
- unsigned int stackSize);
+struct GNUNET_ThreadHandle *GNUNET_thread_create (GNUNET_ThreadMainFunction
+ main, void *arg,
+ unsigned int stackSize);
Modified: GNUnet/src/setup/gtk/ngconf.c
===================================================================
--- GNUnet/src/setup/gtk/ngconf.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/setup/gtk/ngconf.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -149,7 +149,7 @@
(s[strlen (opt)] != ' ')) || ((s != val) && (s[-1] != ' '))))
v = s + 1;
GNUNET_GE_ASSERT (NULL, s != NULL);
- ret = GNUNET_malloc (strlen (val)+1);
+ ret = GNUNET_malloc (strlen (val) + 1);
s[0] = '\0';
if (s != val)
s[-1] = '\0'; /* kill space */
Modified: GNUnet/src/setup/ncurses/wizard_curs.c
===================================================================
--- GNUnet/src/setup/ncurses/wizard_curs.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/setup/ncurses/wizard_curs.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -446,7 +446,7 @@
err = GNUNET_malloc (strlen (cfg_fn) + strlen (prefix) + 1);
sprintf (err, prefix, cfg_fn);
showCursErr (err, STRERROR (errno));
- GNUNET_free(err);
+ GNUNET_free (err);
ret = GNUNET_SYSERR;
}
user_name = NULL;
Modified: GNUnet/src/transports/common.c
===================================================================
--- GNUnet/src/transports/common.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/transports/common.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -152,7 +152,7 @@
is_rejected_ipv6 (const void *addr, unsigned int addr_len)
{
if ((GNUNET_YES == is_blacklisted_ipv6 (addr,
- addr_len)) ||
+ addr_len)) ||
(GNUNET_YES != is_whitelisted_ipv6 (addr, addr_len)))
return GNUNET_YES;
return GNUNET_NO;
@@ -222,19 +222,18 @@
is_rejected_ipv4 (const void *addr, unsigned int addr_len)
{
if ((GNUNET_NO != is_blacklisted_ipv4 (addr,
- addr_len)) ||
+ addr_len)) ||
(GNUNET_YES != is_whitelisted_ipv4 (addr, addr_len)))
return GNUNET_YES;
return GNUNET_NO;
}
static int
-is_rejected_tester(const void *addr,
- unsigned int addr_len)
+is_rejected_tester (const void *addr, unsigned int addr_len)
{
if (addr_len == sizeof (struct sockaddr_in))
- return is_rejected_ipv4(addr, addr_len);
- return is_rejected_ipv6(addr, addr_len);
+ return is_rejected_ipv4 (addr, addr_len);
+ return is_rejected_ipv6 (addr, addr_len);
}
/**
@@ -256,16 +255,24 @@
(ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
(ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
(ntohs (hello->protocol) != myAPI.protocolNumber) ||
- (0 == (ntohs (haddr->availability) & ( VERSION_AVAILABLE_IPV6 |
VERSION_AVAILABLE_IPV4)) ) ||
- ( (0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV4)) &&
- ( (GNUNET_YES == is_blacklisted_ipv4 (&haddr->ipv4,
- sizeof (GNUNET_IPv4Address))) ||
- (GNUNET_YES != is_whitelisted_ipv4 (&haddr->ipv4, sizeof
(GNUNET_IPv4Address))) ) ) ||
- ( (0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV6)) &&
- ( (GNUNET_YES == is_blacklisted_ipv6 (&haddr->ipv6,
- sizeof (GNUNET_IPv6Address))) ||
- (GNUNET_YES != is_whitelisted_ipv6 (&haddr->ipv6, sizeof
(GNUNET_IPv6Address))) ) ) )
- return GNUNET_SYSERR; /* invalid */
+ (0 ==
+ (ntohs (haddr->availability) &
+ (VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4)))
+ || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV4))
+ &&
+ ((GNUNET_YES ==
+ is_blacklisted_ipv4 (&haddr->ipv4, sizeof (GNUNET_IPv4Address)))
+ || (GNUNET_YES !=
+ is_whitelisted_ipv4 (&haddr->ipv4,
+ sizeof (GNUNET_IPv4Address)))))
+ || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV6))
+ &&
+ ((GNUNET_YES ==
+ is_blacklisted_ipv6 (&haddr->ipv6, sizeof (GNUNET_IPv6Address)))
+ || (GNUNET_YES !=
+ is_whitelisted_ipv6 (&haddr->ipv6,
+ sizeof (GNUNET_IPv6Address))))))
+ return GNUNET_SYSERR; /* invalid */
return GNUNET_OK;
}
@@ -276,9 +283,9 @@
*/
static int
reload_configuration (void *ctx,
- struct GNUNET_GC_Configuration *cfg,
- struct GNUNET_GE_Context *ectx,
- const char *section, const char *option)
+ struct GNUNET_GC_Configuration *cfg,
+ struct GNUNET_GE_Context *ectx,
+ const char *section, const char *option)
{
char *ch;
@@ -289,11 +296,13 @@
GNUNET_free_non_null (filteredNetworksIPv4);
GNUNET_free_non_null (allowedNetworksIPv4);
ch = NULL;
- GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
"BLACKLISTV4", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
+ "BLACKLISTV4", "", &ch);
filteredNetworksIPv4 = GNUNET_parse_ipv4_network_specification (ectx, ch);
GNUNET_free (ch);
ch = NULL;
- GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
"WHITELISTV4", "", &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
+ "WHITELISTV4", "", &ch);
if (strlen (ch) > 0)
allowedNetworksIPv4 = GNUNET_parse_ipv4_network_specification (ectx, ch);
else
@@ -301,12 +310,12 @@
GNUNET_free (ch);
GNUNET_free_non_null (filteredNetworksIPv6);
GNUNET_free_non_null (allowedNetworksIPv6);
- GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
"BLACKLISTV6", "",
- &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
+ "BLACKLISTV6", "", &ch);
filteredNetworksIPv6 = GNUNET_parse_ipv6_network_specification (ectx, ch);
GNUNET_free (ch);
- GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
"WHITELISTV6", "",
- &ch);
+ GNUNET_GC_get_configuration_value_string (cfg, MY_TRANSPORT_NAME,
+ "WHITELISTV6", "", &ch);
if (strlen (ch) > 0)
allowedNetworksIPv6 = GNUNET_parse_ipv6_network_specification (ectx, ch);
else
@@ -356,7 +365,7 @@
HostAddress *haddr;
unsigned short port;
unsigned short available;
-
+
port = get_port ();
if (0 == port)
{
@@ -367,7 +376,7 @@
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
_("Port is 0, will only send using %s.\n"),
- MY_TRANSPORT_NAME);
+ MY_TRANSPORT_NAME);
}
return NULL; /* TCP transport is configured SEND-only! */
}
@@ -375,34 +384,35 @@
haddr = (HostAddress *) & msg[1];
available = VERSION_AVAILABLE_NONE;
- if ( (((upnp != NULL) &&
- (GNUNET_OK == upnp->get_ip (port,
- MY_TRANSPORT_NAME,
- &haddr->ipv4))) ||
- (GNUNET_SYSERR !=
- GNUNET_IP_get_public_ipv4_address (cfg, coreAPI->ectx,
&haddr->ipv4))))
+ if ((((upnp != NULL) &&
+ (GNUNET_OK == upnp->get_ip (port,
+ MY_TRANSPORT_NAME,
+ &haddr->ipv4))) ||
+ (GNUNET_SYSERR !=
+ GNUNET_IP_get_public_ipv4_address (cfg, coreAPI->ectx,
+ &haddr->ipv4))))
{
if (0 != memcmp (&haddr->ipv4,
- &last_addrv4,
- sizeof (GNUNET_IPv4Address)))
- {
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
- "%s uses IPv4 address %u.%u.%u.%u.\n",
- MY_TRANSPORT_NAME,
- GNUNET_PRIP (ntohl (*(int *) &haddr->ipv4)));
- last_addrv4 = haddr->ipv4;
- }
+ &last_addrv4, sizeof (GNUNET_IPv4Address)))
+ {
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
+ "%s uses IPv4 address %u.%u.%u.%u.\n",
+ MY_TRANSPORT_NAME,
+ GNUNET_PRIP (ntohl (*(int *) &haddr->ipv4)));
+ last_addrv4 = haddr->ipv4;
+ }
available |= VERSION_AVAILABLE_IPV4;
}
-
- if (GNUNET_SYSERR != GNUNET_IP_get_public_ipv6_address (cfg, coreAPI->ectx,
&haddr->ipv6))
+
+ if (GNUNET_SYSERR !=
+ GNUNET_IP_get_public_ipv6_address (cfg, coreAPI->ectx, &haddr->ipv6))
{
available |= VERSION_AVAILABLE_IPV6;
}
if (available == VERSION_AVAILABLE_NONE)
{
- GNUNET_free(msg);
+ GNUNET_free (msg);
return NULL;
}
haddr->port = htons (port);
@@ -418,14 +428,14 @@
*/
static int
hello_to_address (const GNUNET_MessageHello * hello,
- void **sa, unsigned int *sa_len)
+ void **sa, unsigned int *sa_len)
{
const HostAddress *haddr = (const HostAddress *) &hello[1];
struct sockaddr_in *serverAddr4;
struct sockaddr_in6 *serverAddr6;
unsigned short available;
-
- available = ntohs(haddr->availability);
+
+ available = ntohs (haddr->availability);
if (0 != (available & VERSION_AVAILABLE_IPV4))
{
*sa_len = sizeof (struct sockaddr_in);
@@ -433,7 +443,8 @@
*sa = serverAddr4;
memset (serverAddr4, 0, sizeof (struct sockaddr_in));
serverAddr4->sin_family = AF_INET;
- memcpy (&serverAddr4->sin_addr, &haddr->ipv4, sizeof
(GNUNET_IPv4Address));
+ memcpy (&serverAddr4->sin_addr, &haddr->ipv4,
+ sizeof (GNUNET_IPv4Address));
serverAddr4->sin_port = haddr->port;
}
else if (0 != (available & VERSION_AVAILABLE_IPV6))
@@ -443,7 +454,8 @@
*sa = serverAddr6;
memset (serverAddr6, 0, sizeof (struct sockaddr_in6));
serverAddr6->sin6_family = AF_INET6;
- memcpy (&serverAddr6->sin6_addr, &haddr->ipv6, sizeof
(GNUNET_IPv6Address));
+ memcpy (&serverAddr6->sin6_addr, &haddr->ipv6,
+ sizeof (GNUNET_IPv6Address));
serverAddr6->sin6_port = haddr->port;
}
else
@@ -452,8 +464,8 @@
}
-static void
-do_shutdown()
+static void
+do_shutdown ()
{
GNUNET_GC_detach_change_listener (cfg, &reload_configuration, NULL);
if (stats != NULL)
@@ -477,4 +489,3 @@
GNUNET_mutex_destroy (lock);
lock = NULL;
}
-
Modified: GNUnet/src/transports/ip.c
===================================================================
--- GNUnet/src/transports/ip.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/transports/ip.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -235,8 +235,8 @@
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
- _("Could not find IPv6 address of host `%s': %s\n"),
hostname,
- hstrerror (h_errno));
+ _("Could not find IPv6 address of host `%s': %s\n"),
+ hostname, hstrerror (h_errno));
return GNUNET_SYSERR;
}
if (ip->h_addrtype != AF_INET6)
@@ -369,8 +369,8 @@
*/
int
GNUNET_IP_get_public_ipv6_address (struct GNUNET_GC_Configuration *cfg,
- struct GNUNET_GE_Context *ectx,
- GNUNET_IPv6Address * address)
+ struct GNUNET_GE_Context *ectx,
+ GNUNET_IPv6Address * address)
{
static GNUNET_IPv6Address myAddress;
static GNUNET_CronTime last;
Modified: GNUnet/src/transports/ip.h
===================================================================
--- GNUnet/src/transports/ip.h 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/transports/ip.h 2008-02-13 07:13:25 UTC (rev 6275)
@@ -55,8 +55,8 @@
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int GNUNET_IP_get_public_ipv6_address (struct GNUNET_GC_Configuration *cfg,
- struct GNUNET_GE_Context *ectx,
- GNUNET_IPv6Address * address);
+ struct GNUNET_GE_Context *ectx,
+ GNUNET_IPv6Address * address);
/**
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/transports/tcp.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -321,7 +321,7 @@
GNUNET_GE_ASSERT (NULL, sock != NULL);
if (GNUNET_NO != is_rejected_tester (addr, addr_len))
- return NULL;
+ return NULL;
tcpSession = GNUNET_malloc (sizeof (TCPSession));
memset (tcpSession, 0, sizeof (TCPSession));
tcpSession->sock = sock;
@@ -341,8 +341,7 @@
if (addr_len > 0)
{
tcpSession->accept_addr = GNUNET_malloc (addr_len);
- memcpy (tcpSession->accept_addr,
- addr, sizeof (struct sockaddr_in));
+ memcpy (tcpSession->accept_addr, addr, sizeof (struct sockaddr_in));
}
tcpSession->addr_len = addr_len;
GNUNET_mutex_lock (lock);
@@ -377,7 +376,7 @@
*/
static int
tcp_send (GNUNET_TSession * tsession,
- const void *msg, unsigned int size, int important)
+ const void *msg, unsigned int size, int important)
{
TCPSession *tcpSession;
GNUNET_MessageHeader *mp;
@@ -437,7 +436,7 @@
*/
static int
tcp_test_would_try (GNUNET_TSession * tsession, unsigned int size,
- int important)
+ int important)
{
TCPSession *tcpSession = tsession->internal;
@@ -469,8 +468,9 @@
*/
static int
tcp_connect_helper (const GNUNET_MessageHello * hello,
- struct GNUNET_SocketHandle *s,
- unsigned int protocolNumber, GNUNET_TSession ** tsessionPtr)
+ struct GNUNET_SocketHandle *s,
+ unsigned int protocolNumber,
+ GNUNET_TSession ** tsessionPtr)
{
TCPWelcome welcome;
GNUNET_TSession *tsession;
@@ -529,15 +529,15 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-tcp_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
- int may_reuse)
+tcp_connect (const GNUNET_MessageHello * hello,
+ GNUNET_TSession ** tsessionPtr, int may_reuse)
{
static int zero = 0;
HostAddress *haddr;
int sock;
struct sockaddr_in soaddr4;
struct sockaddr_in6 soaddr6;
- struct sockaddr * soaddr;
+ struct sockaddr *soaddr;
socklen_t soaddrlen;
struct GNUNET_SocketHandle *s;
int i;
@@ -559,10 +559,9 @@
if (session->in_select)
{
session->users++;
- if (session->in_select == GNUNET_YES)
- GNUNET_select_change_timeout (selector,
- session->sock,
- TCP_TIMEOUT);
+ if (session->in_select == GNUNET_YES)
+ GNUNET_select_change_timeout (selector,
+ session->sock, TCP_TIMEOUT);
GNUNET_mutex_unlock (lock);
*tsessionPtr = session->tsession;
return GNUNET_OK;
@@ -573,14 +572,14 @@
GNUNET_mutex_unlock (lock);
}
haddr = (HostAddress *) & hello[1];
- available = ntohs(haddr->availability) & available_protocols;
+ available = ntohs (haddr->availability) & available_protocols;
- if ( (available & VERSION_AVAILABLE_IPV4) > 0)
+ if ((available & VERSION_AVAILABLE_IPV4) > 0)
sock = SOCKET (PF_INET, SOCK_STREAM, 0);
- else if ( (available & VERSION_AVAILABLE_IPV6) > 0)
+ else if ((available & VERSION_AVAILABLE_IPV6) > 0)
sock = SOCKET (PF_INET6, SOCK_STREAM, 0);
else
- return GNUNET_SYSERR; /* incompatible */
+ return GNUNET_SYSERR; /* incompatible */
if (sock == -1)
{
GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
@@ -600,33 +599,28 @@
return GNUNET_SYSERR;
}
memset (&soaddr, 0, sizeof (soaddr));
- if ( (available & VERSION_AVAILABLE_IPV4) > 0)
+ if ((available & VERSION_AVAILABLE_IPV4) > 0)
{
soaddr4.sin_family = AF_INET;
- memcpy (&soaddr4.sin_addr,
- &haddr->ipv4,
- sizeof (GNUNET_IPv4Address));
- soaddr4.sin_port = haddr->port;
- soaddr = (struct sockaddr*) &soaddr4;
- soaddrlen = sizeof(soaddr4);
- }
+ memcpy (&soaddr4.sin_addr, &haddr->ipv4, sizeof (GNUNET_IPv4Address));
+ soaddr4.sin_port = haddr->port;
+ soaddr = (struct sockaddr *) &soaddr4;
+ soaddrlen = sizeof (soaddr4);
+ }
else
{
soaddr6.sin6_family = AF_INET6;
- memcpy (&soaddr6.sin6_addr,
- &haddr->ipv6,
- sizeof (GNUNET_IPv6Address));
- soaddr6.sin6_port = haddr->port;
- soaddr = (struct sockaddr*) &soaddr6;
- soaddrlen = sizeof(soaddr6);
- }
+ memcpy (&soaddr6.sin6_addr, &haddr->ipv6, sizeof (GNUNET_IPv6Address));
+ soaddr6.sin6_port = haddr->port;
+ soaddr = (struct sockaddr *) &soaddr6;
+ soaddrlen = sizeof (soaddr6);
+ }
i = CONNECT (sock, soaddr, soaddrlen);
if ((i < 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK))
{
GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
- GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "connect");
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
+ GNUNET_GE_USER | GNUNET_GE_BULK, "connect");
GNUNET_socket_destroy (s);
return GNUNET_SYSERR;
}
@@ -642,7 +636,7 @@
{
struct sockaddr_in serverAddrv4;
struct sockaddr_in6 serverAddrv6;
- struct sockaddr * serverAddr;
+ struct sockaddr *serverAddr;
socklen_t addrlen;
const int on = 1;
unsigned short port;
@@ -659,43 +653,44 @@
available_protocols = VERSION_AVAILABLE_NONE;
s = SOCKET (PF_INET6, SOCK_STREAM, 0);
if (s < 0)
- {
- s = SOCKET (PF_INET, SOCK_STREAM, 0);
- if (s < 0)
- {
- GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
- GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
- GNUNET_GE_BULK, "socket");
- return GNUNET_SYSERR;
- }
- available_protocols = VERSION_AVAILABLE_IPV4;
- }
+ {
+ s = SOCKET (PF_INET, SOCK_STREAM, 0);
+ if (s < 0)
+ {
+ GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
+ GNUNET_GE_BULK, "socket");
+ return GNUNET_SYSERR;
+ }
+ available_protocols = VERSION_AVAILABLE_IPV4;
+ }
else
- {
- available_protocols = VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4;
- }
+ {
+ available_protocols =
+ VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4;
+ }
if (SETSOCKOPT (s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
GNUNET_GE_DIE_STRERROR (coreAPI->ectx,
GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE, "setsockopt");
if (available_protocols == VERSION_AVAILABLE_IPV4)
- {
- memset (&serverAddr, 0, sizeof (serverAddr));
- serverAddrv4.sin_family = AF_INET;
- serverAddrv4.sin_addr.s_addr = INADDR_ANY;
- serverAddrv4.sin_port = htons (port);
- serverAddr = (struct sockaddr *) &serverAddrv4;
- addrlen = sizeof(serverAddrv4);
- }
+ {
+ memset (&serverAddr, 0, sizeof (serverAddr));
+ serverAddrv4.sin_family = AF_INET;
+ serverAddrv4.sin_addr.s_addr = INADDR_ANY;
+ serverAddrv4.sin_port = htons (port);
+ serverAddr = (struct sockaddr *) &serverAddrv4;
+ addrlen = sizeof (serverAddrv4);
+ }
else
- {
- memset (&serverAddrv6, 0, sizeof (serverAddrv6));
- serverAddrv6.sin6_family = AF_INET6;
- serverAddrv6.sin6_addr = in6addr_any;
- serverAddrv6.sin6_port = htons (port);
- serverAddr = (struct sockaddr *) &serverAddrv6;
- addrlen = sizeof(serverAddrv6);
- }
+ {
+ memset (&serverAddrv6, 0, sizeof (serverAddrv6));
+ serverAddrv6.sin6_family = AF_INET6;
+ serverAddrv6.sin6_addr = in6addr_any;
+ serverAddrv6.sin6_port = htons (port);
+ serverAddr = (struct sockaddr *) &serverAddrv6;
+ addrlen = sizeof (serverAddrv6);
+ }
if (BIND (s, serverAddr, addrlen) < 0)
{
GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
@@ -705,8 +700,7 @@
GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
_("Failed to bind to %s port %d.\n"),
- MY_TRANSPORT_NAME,
- port);
+ MY_TRANSPORT_NAME, port);
if (0 != CLOSE (s))
GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
GNUNET_GE_ERROR | GNUNET_GE_USER |
@@ -750,7 +744,7 @@
GNUNET_select_destroy (selector);
selector = NULL;
}
- if (get_port() == 0)
+ if (get_port () == 0)
available_protocols = VERSION_AVAILABLE_NONE;
return GNUNET_OK;
}
@@ -768,7 +762,8 @@
GNUNET_GE_ASSERT (coreAPI->ectx, sizeof (GNUNET_MessageHeader) == 4);
GNUNET_GE_ASSERT (coreAPI->ectx, sizeof (TCPWelcome) == 68);
lock = GNUNET_mutex_create (GNUNET_YES);
- if (0 != GNUNET_GC_attach_change_listener (cfg, &reload_configuration, NULL))
+ if (0 !=
+ GNUNET_GC_attach_change_listener (cfg, &reload_configuration, NULL))
{
GNUNET_mutex_destroy (lock);
lock = NULL;
@@ -802,7 +797,7 @@
}
myAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP;
myAPI.mtu = 0;
- myAPI.cost = 20000; /* about equal to udp */
+ myAPI.cost = 20000; /* about equal to udp */
myAPI.verifyHello = &verify_hello;
myAPI.createhello = &create_hello;
myAPI.connect = &tcp_connect;
@@ -820,7 +815,7 @@
void
donetransport_tcp ()
{
- do_shutdown();
+ do_shutdown ();
}
/* end of tcp.c */
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/transports/udp.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -104,7 +104,7 @@
{
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
- _("Received malformed message via UDP. Ignored.\n"));
+ _("Received malformed message via UDP. Ignored.\n"));
return GNUNET_SYSERR;
}
um = (const UDPMessage *) msg;
@@ -129,7 +129,7 @@
static int nonnullpointer;
if (GNUNET_NO != is_rejected_tester (addr, addr_len))
- return NULL;
+ return NULL;
return &nonnullpointer;
}
@@ -153,8 +153,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
static int
-udp_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
- int may_reuse)
+udp_connect (const GNUNET_MessageHello * hello,
+ GNUNET_TSession ** tsessionPtr, int may_reuse)
{
GNUNET_TSession *tsession;
@@ -239,7 +239,8 @@
* GNUNET_SYSERR if the size/session is invalid
*/
static int
-udp_test_would_try (GNUNET_TSession * tsession, unsigned int size, int
important)
+udp_test_would_try (GNUNET_TSession * tsession, unsigned int size,
+ int important)
{
const GNUNET_MessageHello *hello;
@@ -266,7 +267,7 @@
* try IPv4. Update available_protocols accordingly.
*/
static int
-udp_create_socket()
+udp_create_socket ()
{
int s;
@@ -284,18 +285,18 @@
s = win_ols_socket (PF_INET, SOCK_DGRAM, 17);
#endif
if (s < 0)
- {
- GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
- GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
- GNUNET_GE_BULK, "socket");
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
+ GNUNET_GE_BULK, "socket");
+ return GNUNET_SYSERR;
+ }
available_protocols = VERSION_AVAILABLE_IPV4;
}
else
{
available_protocols = VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4;
- }
+ }
return s;
}
@@ -309,14 +310,14 @@
*/
static int
udp_send (GNUNET_TSession * tsession,
- const void *message, const unsigned int size, int important)
+ const void *message, const unsigned int size, int important)
{
const GNUNET_MessageHello *hello;
const HostAddress *haddr;
UDPMessage *mp;
struct sockaddr_in serverAddrv4;
struct sockaddr_in6 serverAddrv6;
- struct sockaddr * serverAddr;
+ struct sockaddr *serverAddr;
socklen_t addrlen;
unsigned short available;
int ok;
@@ -340,9 +341,9 @@
if (hello == NULL)
return GNUNET_SYSERR;
- haddr = (const HostAddress *) & hello[1];
- available = ntohs(haddr->availability) & available_protocols;
- if (available == VERSION_AVAILABLE_NONE)
+ haddr = (const HostAddress *) &hello[1];
+ available = ntohs (haddr->availability) & available_protocols;
+ if (available == VERSION_AVAILABLE_NONE)
return GNUNET_SYSERR;
ssize = size + sizeof (UDPMessage);
@@ -352,33 +353,33 @@
mp->sender = *(coreAPI->myIdentity);
memcpy (&mp[1], message, size);
ok = GNUNET_SYSERR;
-
+
if ((available & VERSION_AVAILABLE_IPV4) > 0)
{
memset (&serverAddrv4, 0, sizeof (serverAddrv4));
serverAddrv4.sin_family = AF_INET;
serverAddrv4.sin_port = haddr->port;
memcpy (&serverAddrv4.sin_addr, &haddr->ipv4,
- sizeof (GNUNET_IPv4Address));
- addrlen = sizeof(serverAddrv4);
- serverAddr = (struct sockaddr*) &serverAddrv4;
- }
+ sizeof (GNUNET_IPv4Address));
+ addrlen = sizeof (serverAddrv4);
+ serverAddr = (struct sockaddr *) &serverAddrv4;
+ }
else
{
memset (&serverAddrv6, 0, sizeof (serverAddrv6));
serverAddrv6.sin6_family = AF_INET;
serverAddrv6.sin6_port = haddr->port;
memcpy (&serverAddrv6.sin6_addr, &haddr->ipv6,
- sizeof (GNUNET_IPv6Address));
- addrlen = sizeof(serverAddrv6);
- serverAddr = (struct sockaddr*) &serverAddrv6;
+ sizeof (GNUNET_IPv6Address));
+ addrlen = sizeof (serverAddrv6);
+ serverAddr = (struct sockaddr *) &serverAddrv6;
}
#ifndef MINGW
if (GNUNET_YES == GNUNET_socket_send_to (udp_sock,
GNUNET_NC_NONBLOCKING,
mp,
- ssize, &sent,
- (const char *) serverAddr,
+ ssize, &sent,
+ (const char *) serverAddr,
addrlen))
#else
sent =
@@ -409,7 +410,7 @@
{
struct sockaddr_in serverAddrv4;
struct sockaddr_in6 serverAddrv6;
- struct sockaddr * serverAddr;
+ struct sockaddr *serverAddr;
socklen_t addrlen;
int sock;
const int on = 1;
@@ -419,54 +420,53 @@
/* initialize UDP network */
port = get_port ();
if (port != 0)
- {
- sock = udp_create_socket();
+ {
+ sock = udp_create_socket ();
if (sock < 0)
- return GNUNET_SYSERR;
+ return GNUNET_SYSERR;
if (SETSOCKOPT (sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0)
- {
- GNUNET_GE_DIE_STRERROR (coreAPI->ectx,
- GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
- GNUNET_GE_IMMEDIATE, "setsockopt");
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_GE_DIE_STRERROR (coreAPI->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "setsockopt");
+ return GNUNET_SYSERR;
+ }
if (available_protocols == VERSION_AVAILABLE_IPV4)
- {
- memset (&serverAddrv4, 0, sizeof (serverAddrv4));
- serverAddrv4.sin_family = AF_INET;
- serverAddrv4.sin_addr.s_addr = INADDR_ANY;
- serverAddrv4.sin_port = htons (port);
- addrlen = sizeof(serverAddrv4);
- serverAddr = (struct sockaddr*) &serverAddrv4;
- }
+ {
+ memset (&serverAddrv4, 0, sizeof (serverAddrv4));
+ serverAddrv4.sin_family = AF_INET;
+ serverAddrv4.sin_addr.s_addr = INADDR_ANY;
+ serverAddrv4.sin_port = htons (port);
+ addrlen = sizeof (serverAddrv4);
+ serverAddr = (struct sockaddr *) &serverAddrv4;
+ }
else
- {
- memset (&serverAddrv6, 0, sizeof (serverAddrv6));
- serverAddrv6.sin6_family = AF_INET6;
- serverAddrv6.sin6_addr = in6addr_any;
- serverAddrv6.sin6_port = htons (port);
- addrlen = sizeof(serverAddrv6);
- serverAddr = (struct sockaddr*) &serverAddrv6;
- }
+ {
+ memset (&serverAddrv6, 0, sizeof (serverAddrv6));
+ serverAddrv6.sin6_family = AF_INET6;
+ serverAddrv6.sin6_addr = in6addr_any;
+ serverAddrv6.sin6_port = htons (port);
+ addrlen = sizeof (serverAddrv6);
+ serverAddr = (struct sockaddr *) &serverAddrv6;
+ }
if (BIND (sock, serverAddr, addrlen) < 0)
- {
- GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
- GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
- GNUNET_GE_IMMEDIATE, "bind");
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
GNUNET_GE_IMMEDIATE,
- _("Failed to bind to %s port %d.\n"),
- MY_TRANSPORT_NAME,
- port);
- if (0 != CLOSE (sock))
- GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
- GNUNET_GE_ERROR | GNUNET_GE_USER |
- GNUNET_GE_ADMIN | GNUNET_GE_BULK,
- "close");
- return GNUNET_SYSERR;
- }
- selector = GNUNET_select_create ("udp", GNUNET_YES, coreAPI->ectx,
load_monitor, sock,
- addrlen, 0, /* timeout */
+ {
+ GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE, "bind");
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_FATAL | GNUNET_GE_ADMIN |
+ GNUNET_GE_IMMEDIATE,
+ _("Failed to bind to %s port %d.\n"),
+ MY_TRANSPORT_NAME, port);
+ if (0 != CLOSE (sock))
+ GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_USER |
+ GNUNET_GE_ADMIN | GNUNET_GE_BULK,
+ "close");
+ return GNUNET_SYSERR;
+ }
+ selector = GNUNET_select_create ("udp", GNUNET_YES, coreAPI->ectx,
load_monitor, sock, addrlen, 0, /* timeout */
&select_message_handler,
NULL,
&select_accept_handler,
@@ -477,7 +477,7 @@
if (selector == NULL)
return GNUNET_SYSERR;
}
- sock = udp_create_socket();
+ sock = udp_create_socket ();
if (sock == -1)
{
GNUNET_GE_LOG_STRERROR (coreAPI->ectx,
@@ -524,7 +524,8 @@
GNUNET_GE_ERROR | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
_("MTU %llu for `%s' is probably too low!\n"), mtu, "UDP");
lock = GNUNET_mutex_create (GNUNET_NO);
- if (0 != GNUNET_GC_attach_change_listener (cfg, &reload_configuration, NULL))
+ if (0 !=
+ GNUNET_GC_attach_change_listener (cfg, &reload_configuration, NULL))
{
GNUNET_mutex_destroy (lock);
lock = NULL;
@@ -571,7 +572,7 @@
void
donetransport_udp ()
{
- do_shutdown();
+ do_shutdown ();
}
/* end of udp.c */
Modified: GNUnet/src/transports/upnp/util.c
===================================================================
--- GNUnet/src/transports/upnp/util.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/transports/upnp/util.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -34,7 +34,7 @@
int len;
int pound;
char b[7];
- char * buf;
+ char *buf;
if (!text || *text != '&')
return NULL;
@@ -61,9 +61,8 @@
pound != 0 && *(text + 3 + (int) log10 (pound)) == ';')
{
buf = GNUNET_convert_string_to_utf8 (NULL,
- (const char *) £,
- 2,
- "UNICODE");
+ (const char *) £,
+ 2, "UNICODE");
if (strlen (buf) > 6)
buf[6] = '\0';
strcpy (b, buf);
Modified: GNUnet/src/util/containers/bloomfilter.c
===================================================================
--- GNUnet/src/util/containers/bloomfilter.c 2008-02-13 07:00:17 UTC (rev
6274)
+++ GNUnet/src/util/containers/bloomfilter.c 2008-02-13 07:13:25 UTC (rev
6275)
@@ -638,18 +638,18 @@
* match.
* @param bf the filter
*/
-int GNUNET_bloomfilter_or (struct GNUNET_BloomFilter *bf,
- const char * data,
- unsigned int size)
+int
+GNUNET_bloomfilter_or (struct GNUNET_BloomFilter *bf,
+ const char *data, unsigned int size)
{
unsigned int i;
if (bf->bitArraySize != size)
return GNUNET_SYSERR;
- /* FIXME: we could do this 4-8x faster by
+ /* FIXME: we could do this 4-8x faster by
going over int/long arrays */
- for (i=0;i<size;i++)
- bf->bitArray[i] |= data[i];
+ for (i = 0; i < size; i++)
+ bf->bitArray[i] |= data[i];
return GNUNET_OK;
}
Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/util/disk/storage.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -551,7 +551,7 @@
GNUNET_GE_WARNING | GNUNET_GE_USER |
GNUNET_GE_BULK, "opendir", dirName);
if (dinfo != NULL)
- closedir(dinfo);
+ closedir (dinfo);
return GNUNET_SYSERR;
}
while ((finfo = readdir (dinfo)) != NULL)
Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/src/util/network/select.c 2008-02-13 07:13:25 UTC (rev 6275)
@@ -522,22 +522,25 @@
}
}
timeout = -1;
- now = GNUNET_get_time();
+ now = GNUNET_get_time ();
for (i = 0; i < sh->sessionCount; i++)
{
session = sh->sessions[i];
- if (session->timeout != 0)
- {
- if (now > session->lastUse + session->timeout)
- timeout = 0;
- else
- timeout = MIN(timeout, session->lastUse + session->timeout -
now);
+ if (session->timeout != 0)
+ {
+ if (now > session->lastUse + session->timeout)
+ timeout = 0;
+ else
+ timeout =
+ MIN (timeout, session->lastUse + session->timeout - now);
}
}
GNUNET_mutex_unlock (sh->lock);
tv.tv_sec = timeout / GNUNET_CRON_SECONDS;
tv.tv_usec = (timeout % GNUNET_CRON_SECONDS) * 1000;
- ret = SELECT (max + 1, &readSet, &writeSet, &errorSet, (timeout == -1) ?
NULL : &tv);
+ ret =
+ SELECT (max + 1, &readSet, &writeSet, &errorSet,
+ (timeout == -1) ? NULL : &tv);
old_errno = errno;
GNUNET_mutex_lock (sh->lock);
if ((ret == -1) && ((old_errno == EAGAIN) || (old_errno == EINTR)))
@@ -625,7 +628,7 @@
{
session = GNUNET_malloc (sizeof (Session));
memset (session, 0, sizeof (Session));
- session->timeout = sh->timeout;
+ session->timeout = sh->timeout;
session->sock = sock;
session->sock_ctx = sctx;
session->lastUse = GNUNET_get_time ();
@@ -781,7 +784,7 @@
GNUNET_GE_BULK, "read");
}
}
- now = GNUNET_get_time();
+ now = GNUNET_get_time ();
for (i = 0; i < sh->sessionCount; i++)
{
session = sh->sessions[i];
@@ -804,8 +807,8 @@
i--;
continue;
}
- if ( (session->timeout != 0) &&
- (now > session->lastUse + session->timeout) )
+ if ((session->timeout != 0) &&
+ (now > session->lastUse + session->timeout))
{
destroySession (sh, session);
i--;
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-02-13 07:00:17 UTC (rev 6274)
+++ GNUnet/todo 2008-02-13 07:13:25 UTC (rev 6275)
@@ -22,7 +22,6 @@
- tune GAP query planning code [RC]
- reenable and test GAP migration code [RC]
- complete IPv4/IPv6 integration of transports (http is missing!) [RC]
-- integrated hostlist server application using libmicrohttpd [RC]
- Insert/Index a "shared directory" automatically [Nils]
See also: https://gnunet.org/drupal/?q=node/97 [RC]
Furthermore: Blake suggested indexing a document only after
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6275 - in GNUnet: . src/applications/chat src/applications/datastore src/applications/fs/fsui src/applications/fs/gap src/applications/fs/lib src/applications/hostlist src/applications/pingpong src/applications/session src/applications/testing src/include src/setup/gtk src/setup/ncurses src/transports src/transports/upnp src/util/containers src/util/disk src/util/network,
gnunet <=