[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5365 - in GNUnet/src: applications/chat applications/fs/mo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5365 - in GNUnet/src: applications/chat applications/fs/module applications/sqstore_mysql applications/sqstore_sqlite applications/transport include server transports util/network |
Date: |
Sun, 29 Jul 2007 01:34:05 -0600 (MDT) |
Author: grothoff
Date: 2007-07-29 01:34:05 -0600 (Sun, 29 Jul 2007)
New Revision: 5365
Modified:
GNUnet/src/applications/chat/clientapi.c
GNUnet/src/applications/chat/gnunet-chat.c
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/applications/sqstore_mysql/mysql.c
GNUnet/src/applications/sqstore_sqlite/sqlite.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/include/gnunet_chat_lib.h
GNUnet/src/include/gnunet_transport.h
GNUnet/src/include/gnunet_transport_service.h
GNUnet/src/server/handler.c
GNUnet/src/transports/http.c
GNUnet/src/transports/nat.c
GNUnet/src/transports/tcp.c
GNUnet/src/transports/tcp6.c
GNUnet/src/transports/udp_helper.c
GNUnet/src/util/network/io.c
GNUnet/src/util/network/ipcheck.c
GNUnet/src/util/network/ipchecktest.c
Log:
fmt
Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c 2007-07-29 07:14:25 UTC (rev
5364)
+++ GNUnet/src/applications/chat/clientapi.c 2007-07-29 07:34:05 UTC (rev
5365)
@@ -33,31 +33,34 @@
/**
* Handle for a (joined) chat room.
*/
-struct GNUNET_CHAT_Room {
- struct ClientServerConnection * sock;
+struct GNUNET_CHAT_Room
+{
+ struct ClientServerConnection *sock;
- struct PTHREAD * listen_thread;
+ struct PTHREAD *listen_thread;
- struct GE_Context * ectx;
+ struct GE_Context *ectx;
- struct GC_Configuration * cfg;
+ struct GC_Configuration *cfg;
- char * nickname;
+ char *nickname;
- const PublicKey * my_public_key;
+ const PublicKey *my_public_key;
- const struct PrivateKey * my_private_key;
+ const struct PrivateKey *my_private_key;
- char * memberInfo;
+ char *memberInfo;
GNUNET_CHAT_Message_Callback callback;
- void * callback_cls;
+ void *callback_cls;
};
-static void * thread_main(void * rcls) {
- struct GNUNET_CHAT_Room * room = rcls;
+static void *
+thread_main (void *rcls)
+{
+ struct GNUNET_CHAT_Room *room = rcls;
return NULL;
}
@@ -65,10 +68,11 @@
* List all of the (publically visible) chat rooms.
* @return number of rooms on success, SYSERR if iterator aborted
*/
-int GNUNET_CHAT_list_rooms(struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- GNUNET_CHAT_Room_Iterator it,
- void * cls) {
+int
+GNUNET_CHAT_list_rooms (struct GE_Context *ectx,
+ struct GC_Configuration *cfg,
+ GNUNET_CHAT_Room_Iterator it, void *cls)
+{
return SYSERR;
}
@@ -81,16 +85,16 @@
* been received?
* @param cls argument to callback
* @return NULL on error
- */
+ */
struct GNUNET_CHAT_Room *
-GNUNET_CHAT_join_room(struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- const char * nickname,
- const PublicKey * me,
- const struct PrivateKey * key,
- const char * memberInfo,
- GNUNET_CHAT_Message_Callback callback,
- void * cls) {
+GNUNET_CHAT_join_room (struct GE_Context *ectx,
+ struct GC_Configuration *cfg,
+ const char *nickname,
+ const PublicKey * me,
+ const struct PrivateKey *key,
+ const char *memberInfo,
+ GNUNET_CHAT_Message_Callback callback, void *cls)
+{
// connect
// allocate & init room struct
@@ -103,8 +107,10 @@
/**
* Leave a chat room.
- */
-void GNUNET_CHAT_leave_room(struct GNUNET_CHAT_Room * room) {
+ */
+void
+GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *room)
+{
// stop thread
// join thread
// free room struct
@@ -117,12 +123,13 @@
* @return OK on success, SYSERR on error
*/
int
-GNUNET_CHAT_send_message(struct GNUNET_CHAT_Room * room,
- const char * message,
- GNUNET_CHAT_Message_Confirmation callback,
- void * cls,
- GNUNET_CHAT_MSG_OPTIONS options,
- const PublicKey * receiver) {
+GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room,
+ const char *message,
+ GNUNET_CHAT_Message_Confirmation callback,
+ void *cls,
+ GNUNET_CHAT_MSG_OPTIONS options,
+ const PublicKey * receiver)
+{
return SYSERR;
}
@@ -130,9 +137,10 @@
* List all of the (known) chat members.
* @return number of rooms on success, SYSERR if iterator aborted
*/
-int GNUNET_CHAT_list_members(struct GNUNET_CHAT_Room * room,
- GNUNET_CHAT_Member_Iterator it,
- void * cls) {
+int
+GNUNET_CHAT_list_members (struct GNUNET_CHAT_Room *room,
+ GNUNET_CHAT_Member_Iterator it, void *cls)
+{
return SYSERR;
}
Modified: GNUnet/src/applications/chat/gnunet-chat.c
===================================================================
--- GNUnet/src/applications/chat/gnunet-chat.c 2007-07-29 07:14:25 UTC (rev
5364)
+++ GNUnet/src/applications/chat/gnunet-chat.c 2007-07-29 07:34:05 UTC (rev
5365)
@@ -32,17 +32,17 @@
static struct GE_Context *ectx;
-static char * cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
+static char *cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
-static char * nickname;
+static char *nickname;
-static char * roomname = "gnunet";
+static char *roomname = "gnunet";
/**
* All gnunet-chat command line options
*/
static struct CommandLineOption gnunetchatOptions[] = {
- COMMAND_LINE_OPTION_HELP (gettext_noop ("Join a chat on GNUnet.")), /*
-h */
+ COMMAND_LINE_OPTION_HELP (gettext_noop ("Join a chat on GNUnet.")), /* -h
*/
COMMAND_LINE_OPTION_HOSTNAME, /* -H */
COMMAND_LINE_OPTION_LOGGING, /* -L */
{'n', "nick", "NAME",
@@ -71,16 +71,14 @@
* @return OK to accept the message now, NO to
* accept (but user is away), SYSERR to signal denied delivery
*/
-static int receive_callback(void * cls,
- struct GNUNET_CHAT_Room * room,
- const char * senderNick,
- const char * message,
- cron_t timestamp,
- GNUNET_CHAT_MSG_OPTIONS options) {
- fprintf(stdout,
- "%s: %s\n",
- senderNick,
- message);
+static int
+receive_callback (void *cls,
+ struct GNUNET_CHAT_Room *room,
+ const char *senderNick,
+ const char *message,
+ cron_t timestamp, GNUNET_CHAT_MSG_OPTIONS options)
+{
+ fprintf (stdout, "%s: %s\n", senderNick, message);
return OK;
}
@@ -98,15 +96,16 @@
* @return OK to continue, SYSERR to refuse processing further
* confirmations from anyone for this message
*/
-static int confirmation_callback(void * cls,
- struct GNUNET_CHAT_Room * room,
- const char * receiverNick,
- const PublicKey * receiverKey,
- const char * message,
- cron_t timestamp,
- GNUNET_CHAT_MSG_OPTIONS options,
- int response,
- const Signature * receipt) {
+static int
+confirmation_callback (void *cls,
+ struct GNUNET_CHAT_Room *room,
+ const char *receiverNick,
+ const PublicKey * receiverKey,
+ const char *message,
+ cron_t timestamp,
+ GNUNET_CHAT_MSG_OPTIONS options,
+ int response, const Signature * receipt)
+{
return OK;
}
@@ -120,38 +119,31 @@
int
main (int argc, char **argv)
{
- struct GNUNET_CHAT_Room * room;
- PublicKey * my_pub;
- struct PrivateKey * my_priv;
+ struct GNUNET_CHAT_Room *room;
+ PublicKey *my_pub;
+ struct PrivateKey *my_priv;
char message[1024];
-
- if (SYSERR == GNUNET_init (argc,
- argv,
- "gnunet-chat [OPTIONS]",
- &cfgFilename,
- gnunetchatOptions,
- &ectx,
- &cfg))
+
+ if (SYSERR == GNUNET_init (argc,
+ argv,
+ "gnunet-chat [OPTIONS]",
+ &cfgFilename, gnunetchatOptions, &ectx, &cfg))
return 1; /* parse error, --help, etc. */
- if (nickname == NULL) {
- fprintf(stderr,
- _("You must specify a nickname\n"));
- return 1;
- }
+ if (nickname == NULL)
+ {
+ fprintf (stderr, _("You must specify a nickname\n"));
+ return 1;
+ }
/* FIXME: load/generate private key! */
- room = GNUNET_CHAT_join_room(ectx,
- cfg,
- nickname,
- my_pub,
- my_priv,
- "",
- &receive_callback,
- NULL);
- if (room == NULL) {
- fprintf(stderr,
- _("Failed to join the room\n"));
- return 1;
- }
+ room = GNUNET_CHAT_join_room (ectx,
+ cfg,
+ nickname,
+ my_pub, my_priv, "", &receive_callback, NULL);
+ if (room == NULL)
+ {
+ fprintf (stderr, _("Failed to join the room\n"));
+ return 1;
+ }
/* read messages from command line and send */
while (1)
@@ -159,18 +151,17 @@
memset (message, 0, 1024);
if (NULL == fgets (message, 1023, stdin))
break;
- if (OK != GNUNET_CHAT_send_message(room,
- message,
- &confirmation_callback,
- NULL,
- GNUNET_CHAT_MSG_OPTION_NONE,
- NULL)) {
- fprintf(stderr,
- _("Failed to send message.\n"));
- }
+ if (OK != GNUNET_CHAT_send_message (room,
+ message,
+ &confirmation_callback,
+ NULL,
+ GNUNET_CHAT_MSG_OPTION_NONE, NULL))
+ {
+ fprintf (stderr, _("Failed to send message.\n"));
+ }
}
- GNUNET_CHAT_leave_room(room);
- GNUNET_fini(ectx, cfg);
+ GNUNET_CHAT_leave_room (room);
+ GNUNET_fini (ectx, cfg);
return 0;
}
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2007-07-29 07:14:25 UTC (rev
5364)
+++ GNUnet/src/applications/fs/module/fs.c 2007-07-29 07:34:05 UTC (rev
5365)
@@ -220,7 +220,7 @@
ret = OK;
FREE (dv);
if (ret == SYSERR)
- ret = NO; /* error in put != content invalid! */
+ ret = NO; /* error in put != content invalid! */
return ret;
}
Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c 2007-07-29 07:14:25 UTC
(rev 5364)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c 2007-07-29 07:34:05 UTC
(rev 5365)
@@ -227,7 +227,7 @@
#define SELECT_IT_MIGRATION_ORDER "SELECT * FROM gn071 WHERE ( (expire = ? AND
vkey < ?) OR (expire < ? AND vkey != ?) ) "\
"AND expire > ? AND type!=3 "\
"ORDER BY expire DESC,vkey DESC LIMIT 1"
- MYSQL_STMT * iter[4];
+ MYSQL_STMT *iter[4];
} mysqlHandle;
@@ -612,11 +612,11 @@
rbind[0].buffer_length = contentSize;
rbind[0].length = &length;
rbind[0].buffer = &datum[1];
- MUTEX_LOCK(lock);
+ MUTEX_LOCK (lock);
if (OK != CHECK_DBH)
{
MUTEX_UNLOCK (lock);
- FREE(datum);
+ FREE (datum);
return NULL;
}
GE_ASSERT (ectx, mysql_stmt_param_count (dbh->select_value) == 1);
@@ -629,7 +629,7 @@
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
iclose ();
MUTEX_UNLOCK (lock);
- FREE(datum);
+ FREE (datum);
return NULL;
}
if (mysql_stmt_execute (dbh->select_value))
@@ -640,7 +640,7 @@
"mysql_stmt_execute",
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
iclose ();
- FREE(datum);
+ FREE (datum);
return NULL;
}
GE_ASSERT (ectx, mysql_stmt_field_count (dbh->select_value) == 1);
@@ -653,7 +653,7 @@
__FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
iclose ();
MUTEX_UNLOCK (lock);
- FREE(datum);
+ FREE (datum);
return NULL;
}
if ((0 != mysql_stmt_fetch (dbh->select_value)) ||
@@ -668,7 +668,7 @@
delete_entry_by_vkey (vkey);
content_size -= ntohl (datum->size);
MUTEX_UNLOCK (lock);
- FREE(datum);
+ FREE (datum);
return NULL;
}
mysql_stmt_reset (dbh->select_value);
@@ -827,7 +827,7 @@
cron_t now;
MYSQL_BIND qbind[5];
MYSQL_BIND rbind[7];
- MYSQL_STMT * stmt;
+ MYSQL_STMT *stmt;
if (is_asc)
{
@@ -968,10 +968,11 @@
ret = OK;
else
ret = iter (&key, datum, closure, vkey);
- if (ret == SYSERR) {
- FREE(datum);
- break;
- }
+ if (ret == SYSERR)
+ {
+ FREE (datum);
+ break;
+ }
if (ret == NO)
{
MUTEX_LOCK (lock);
@@ -1157,25 +1158,25 @@
return SYSERR;
}
if (type != 0)
- {
- if (iter == NULL)
- stmt = dbh->count_entry_by_hash_and_type;
- else
- stmt = dbh->select_entry_by_hash_and_type;
- }
+ {
+ if (iter == NULL)
+ stmt = dbh->count_entry_by_hash_and_type;
+ else
+ stmt = dbh->select_entry_by_hash_and_type;
+ }
else
- {
- if (iter == NULL)
- stmt = dbh->count_entry_by_hash;
- else
- stmt = dbh->select_entry_by_hash;
- }
+ {
+ if (iter == NULL)
+ stmt = dbh->count_entry_by_hash;
+ else
+ stmt = dbh->select_entry_by_hash;
+ }
GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 3);
if (iter == NULL)
- GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 1);
+ GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 1);
else
- GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
+ GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
if (mysql_stmt_bind_param (stmt, qbind))
{
GE_LOG (ectx,
@@ -1235,10 +1236,11 @@
continue;
count++;
ret = iter (&key, datum, closure, vkey);
- if (ret == SYSERR) {
- FREE(datum);
- break;
- }
+ if (ret == SYSERR)
+ {
+ FREE (datum);
+ break;
+ }
if (ret == NO)
{
MUTEX_LOCK (lock);
Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-07-29 07:14:25 UTC
(rev 5364)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-07-29 07:34:05 UTC
(rev 5365)
@@ -101,9 +101,9 @@
static struct GE_Context *ectx;
-static struct MUTEX * lock;
+static struct MUTEX *lock;
-static char * fn;
+static char *fn;
static unsigned long long payload;
@@ -180,7 +180,7 @@
/* Is the DB already open? */
for (idx = 0; idx < handle_count; idx++)
- if (PTHREAD_TEST_SELF (handles[idx]->tid))
+ if (PTHREAD_TEST_SELF (handles[idx]->tid))
return handles[idx];
/* we haven't opened the DB for this thread yet */
@@ -693,10 +693,10 @@
{
count++;
if (iter != NULL)
- {
- MUTEX_UNLOCK (lock);
- ret = iter (&key, datum, closure, rowid);
- MUTEX_LOCK (lock);
+ {
+ MUTEX_UNLOCK (lock);
+ ret = iter (&key, datum, closure, rowid);
+ MUTEX_LOCK (lock);
if (ret == SYSERR)
{
FREE (datum);
@@ -722,7 +722,7 @@
GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
"sqlite3_step");
sqlite3_finalize (stmt);
- MUTEX_UNLOCK (lock);
+ MUTEX_UNLOCK (lock);
return SYSERR;
}
sqlite3_reset (stmt);
@@ -850,11 +850,13 @@
if (datum == NULL)
continue;
newpayload += getContentDatastoreSize (datum);
- if (iter != NULL) {
- MUTEX_UNLOCK (lock);
- ret = iter (&key, datum, closure, rowid);
- MUTEX_LOCK (lock);
- } else
+ if (iter != NULL)
+ {
+ MUTEX_UNLOCK (lock);
+ ret = iter (&key, datum, closure, rowid);
+ MUTEX_LOCK (lock);
+ }
+ else
ret = OK;
if (ret == SYSERR)
{
@@ -928,7 +930,7 @@
static void
drop ()
{
- char * n = STRDUP (fn);
+ char *n = STRDUP (fn);
sqlite_shutdown ();
UNLINK (n);
FREE (n);
@@ -1011,11 +1013,13 @@
FREE (datum);
continue;
}
- if (iter != NULL) {
- MUTEX_UNLOCK (lock);
- ret = iter (&rkey, datum, closure, rowid);
- MUTEX_LOCK (lock);
- } else
+ if (iter != NULL)
+ {
+ MUTEX_UNLOCK (lock);
+ ret = iter (&rkey, datum, closure, rowid);
+ MUTEX_LOCK (lock);
+ }
+ else
ret = OK;
if (ret == SYSERR)
{
@@ -1027,7 +1031,7 @@
if (ret == NO)
{
payload -= getContentDatastoreSize (datum);
- delete_by_rowid (handle, rowid);
+ delete_by_rowid (handle, rowid);
}
FREE (datum);
count++;
@@ -1195,7 +1199,7 @@
FREE (fn);
return NULL;
}
- lock = MUTEX_CREATE(NO);
+ lock = MUTEX_CREATE (NO);
coreAPI = capi;
stats = coreAPI->requestService ("stats");
if (stats)
@@ -1227,7 +1231,7 @@
GE_LOG (ectx,
GE_DEBUG | GE_REQUEST | GE_USER, "SQLite: database shutdown\n");
#endif
- MUTEX_DESTROY(lock);
+ MUTEX_DESTROY (lock);
lock = NULL;
coreAPI = NULL;
}
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2007-07-29 07:14:25 UTC
(rev 5364)
+++ GNUnet/src/applications/transport/transport.c 2007-07-29 07:34:05 UTC
(rev 5365)
@@ -229,9 +229,8 @@
* @return session on success, NULL on error
*/
static TSession *
-transportConnect (const P2P_hello_MESSAGE * hello,
- const char *token,
- int may_reuse)
+transportConnect (const P2P_hello_MESSAGE * hello,
+ const char *token, int may_reuse)
{
unsigned short prot;
TSession *tsession;
@@ -247,8 +246,7 @@
return NULL;
}
tsession = NULL;
- if (OK != tapis[prot]->connect (hello, &tsession,
- may_reuse))
+ if (OK != tapis[prot]->connect (hello, &tsession, may_reuse))
return NULL;
tsession->ttype = prot;
MUTEX_LOCK (lock);
Modified: GNUnet/src/include/gnunet_chat_lib.h
===================================================================
--- GNUnet/src/include/gnunet_chat_lib.h 2007-07-29 07:14:25 UTC (rev
5364)
+++ GNUnet/src/include/gnunet_chat_lib.h 2007-07-29 07:34:05 UTC (rev
5365)
@@ -42,7 +42,8 @@
*/
#define GNUNET_CHAT_VERSION "0.0.0"
-typedef enum {
+typedef enum
+{
/**
* No special options.
*/
@@ -87,18 +88,16 @@
*
* @return OK to continue, SYSERR to abort iteration
*/
-typedef int (*GNUNET_CHAT_Room_Iterator)(const char * room,
- const char * topic,
- void * cls);
+typedef int (*GNUNET_CHAT_Room_Iterator) (const char *room,
+ const char *topic, void *cls);
/**
* List all of the (publically visible) chat rooms.
* @return number of rooms on success, SYSERR if iterator aborted
*/
-int GNUNET_CHAT_list_rooms(struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- GNUNET_CHAT_Room_Iterator it,
- void * cls);
+int GNUNET_CHAT_list_rooms (struct GE_Context *ectx,
+ struct GC_Configuration *cfg,
+ GNUNET_CHAT_Room_Iterator it, void *cls);
/**
@@ -121,12 +120,12 @@
* @return OK to accept the message now, NO to
* accept (but user is away), SYSERR to signal denied delivery
*/
-typedef int (*GNUNET_CHAT_Message_Callback)(void * cls,
- struct GNUNET_CHAT_Room * room,
- const char * senderNick,
- const char * message,
- cron_t timestamp,
- GNUNET_CHAT_MSG_OPTIONS options);
+typedef int (*GNUNET_CHAT_Message_Callback) (void *cls,
+ struct GNUNET_CHAT_Room * room,
+ const char *senderNick,
+ const char *message,
+ cron_t timestamp,
+ GNUNET_CHAT_MSG_OPTIONS options);
/**
* Join a chat room.
@@ -137,21 +136,20 @@
* been received?
* @param cls argument to callback
* @return NULL on error
- */
-struct GNUNET_CHAT_Room *
-GNUNET_CHAT_join_room(struct GE_Context * ectx,
- struct GC_Configuration * cfg,
- const char * nickname,
- const PublicKey * me,
- const struct PrivateKey * key,
- const char * memberInfo,
- GNUNET_CHAT_Message_Callback callback,
- void * cls);
+ */
+struct GNUNET_CHAT_Room *GNUNET_CHAT_join_room (struct GE_Context *ectx,
+ struct GC_Configuration *cfg,
+ const char *nickname,
+ const PublicKey * me,
+ const struct PrivateKey *key,
+ const char *memberInfo,
+ GNUNET_CHAT_Message_Callback
+ callback, void *cls);
/**
* Leave a chat room.
- */
-void GNUNET_CHAT_leave_room(struct GNUNET_CHAT_Room * room);
+ */
+void GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *room);
/**
@@ -168,15 +166,17 @@
* @return OK to continue, SYSERR to refuse processing further
* confirmations from anyone for this message
*/
-typedef int (*GNUNET_CHAT_Message_Confirmation)(void * cls,
- struct GNUNET_CHAT_Room * room,
- const char * receiverNick,
- const PublicKey * receiverKey,
- const char * message,
- cron_t timestamp,
- GNUNET_CHAT_MSG_OPTIONS options,
- int response,
- const Signature * receipt);
+typedef int (*GNUNET_CHAT_Message_Confirmation) (void *cls,
+ struct GNUNET_CHAT_Room *
+ room,
+ const char *receiverNick,
+ const PublicKey *
+ receiverKey,
+ const char *message,
+ cron_t timestamp,
+ GNUNET_CHAT_MSG_OPTIONS
+ options, int response,
+ const Signature * receipt);
/**
@@ -186,30 +186,28 @@
* @return OK on success, SYSERR on error
*/
int
-GNUNET_CHAT_send_message(struct GNUNET_CHAT_Room * room,
- const char * message,
- GNUNET_CHAT_Message_Confirmation callback,
- void * cls,
- GNUNET_CHAT_MSG_OPTIONS options,
- const PublicKey * receiver);
+GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room,
+ const char *message,
+ GNUNET_CHAT_Message_Confirmation callback,
+ void *cls,
+ GNUNET_CHAT_MSG_OPTIONS options,
+ const PublicKey * receiver);
/**
* Callback function to iterate over room members.
*/
-typedef int (*GNUNET_CHAT_Member_Iterator)(const char * nickname,
- const PublicKey * owner,
- const char * memberInfo,
- cron_t lastConfirmed,
- void * cls);
+typedef int (*GNUNET_CHAT_Member_Iterator) (const char *nickname,
+ const PublicKey * owner,
+ const char *memberInfo,
+ cron_t lastConfirmed, void *cls);
/**
* List all of the (known) chat members.
* @return number of rooms on success, SYSERR if iterator aborted
*/
-int GNUNET_CHAT_list_members(struct GNUNET_CHAT_Room * room,
- GNUNET_CHAT_Member_Iterator it,
- void * cls);
+int GNUNET_CHAT_list_members (struct GNUNET_CHAT_Room *room,
+ GNUNET_CHAT_Member_Iterator it, void *cls);
Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h 2007-07-29 07:14:25 UTC (rev
5364)
+++ GNUnet/src/include/gnunet_transport.h 2007-07-29 07:34:05 UTC (rev
5365)
@@ -261,7 +261,7 @@
* @return OK on success, SYSERR if the operation failed
*/
int (*connect) (const P2P_hello_MESSAGE * hello, TSession ** tsession,
- int may_reuse);
+ int may_reuse);
/**
* Send a message to the specified remote node.
Modified: GNUnet/src/include/gnunet_transport_service.h
===================================================================
--- GNUnet/src/include/gnunet_transport_service.h 2007-07-29 07:14:25 UTC
(rev 5364)
+++ GNUnet/src/include/gnunet_transport_service.h 2007-07-29 07:34:05 UTC
(rev 5365)
@@ -91,7 +91,7 @@
* @return session handle on success, NULL on error
*/
TSession *(*connect) (const P2P_hello_MESSAGE * hello, const char *token,
- int may_reuse);
+ int may_reuse);
/**
* Connect to another peer, picking any transport that
Modified: GNUnet/src/server/handler.c
===================================================================
--- GNUnet/src/server/handler.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/server/handler.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -496,7 +496,7 @@
FREENONNULL (copy);
copy = NULL;
#if VALIDATE_CLIENT
- FREE(old_value);
+ FREE (old_value);
#endif
return; /* handler says: do not process the rest of
the message */
}
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/transports/http.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -821,7 +821,7 @@
*/
static int
httpConnect (const P2P_hello_MESSAGE * hello, TSession ** tsessionPtr,
- int may_reuse)
+ int may_reuse)
{
const HostAddress *haddr = (const HostAddress *) &hello[1];
TSession *tsession;
Modified: GNUnet/src/transports/nat.c
===================================================================
--- GNUnet/src/transports/nat.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/transports/nat.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -110,7 +110,7 @@
*/
static int
natConnect (const P2P_hello_MESSAGE * hello, TSession ** tsessionPtr,
- int may_reuse)
+ int may_reuse)
{
return SYSERR;
}
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/transports/tcp.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -310,7 +310,7 @@
*/
static int
tcpConnect (const P2P_hello_MESSAGE * hello, TSession ** tsessionPtr,
- int may_reuse)
+ int may_reuse)
{
static int zero = 0;
HostAddress *haddr;
@@ -322,31 +322,32 @@
if (selector == NULL)
return SYSERR;
- if (may_reuse != NO) {
- MUTEX_LOCK (tcplock);
- session = sessions;
- while (session != NULL)
- {
- if (0 == memcmp (&session->sender,
- &hello->senderIdentity, sizeof (PeerIdentity)))
- {
- MUTEX_LOCK (session->lock);
- if (session->in_select)
- {
- session->users++;
- MUTEX_UNLOCK (session->lock);
- MUTEX_UNLOCK (tcplock);
- *tsessionPtr = session->tsession;
- return OK;
- }
- MUTEX_UNLOCK (session->lock);
- }
- session = session->next;
- }
- MUTEX_UNLOCK (tcplock);
- }
+ if (may_reuse != NO)
+ {
+ MUTEX_LOCK (tcplock);
+ session = sessions;
+ while (session != NULL)
+ {
+ if (0 == memcmp (&session->sender,
+ &hello->senderIdentity, sizeof (PeerIdentity)))
+ {
+ MUTEX_LOCK (session->lock);
+ if (session->in_select)
+ {
+ session->users++;
+ MUTEX_UNLOCK (session->lock);
+ MUTEX_UNLOCK (tcplock);
+ *tsessionPtr = session->tsession;
+ return OK;
+ }
+ MUTEX_UNLOCK (session->lock);
+ }
+ session = session->next;
+ }
+ MUTEX_UNLOCK (tcplock);
+ }
haddr = (HostAddress *) & hello[1];
-#if DEBUG_TCP
+#if DEBUG_TCP
GE_LOG (ectx,
GE_DEBUG | GE_USER | GE_BULK,
"Creating TCP connection to %u.%u.%u.%u:%u.\n",
Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/transports/tcp6.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -262,7 +262,7 @@
*/
static int
tcp6Connect (const P2P_hello_MESSAGE * hello, TSession ** tsessionPtr,
- int may_reuse)
+ int may_reuse)
{
int i;
Host6Address *haddr;
@@ -275,28 +275,29 @@
if (selector == NULL)
return SYSERR;
- if (NO != may_reuse) {
- MUTEX_LOCK (tcplock);
- session = sessions;
- while (session != NULL)
- {
- if (0 == memcmp (&session->sender,
- &hello->senderIdentity, sizeof (PeerIdentity)))
- {
- MUTEX_LOCK (session->lock);
- if (session->in_select)
- {
- session->users++;
- MUTEX_UNLOCK (session->lock);
- MUTEX_UNLOCK (tcplock);
- *tsessionPtr = session->tsession;
- return OK;
- }
- MUTEX_UNLOCK (session->lock);
- }
- session = session->next;
- }
- }
+ if (NO != may_reuse)
+ {
+ MUTEX_LOCK (tcplock);
+ session = sessions;
+ while (session != NULL)
+ {
+ if (0 == memcmp (&session->sender,
+ &hello->senderIdentity, sizeof (PeerIdentity)))
+ {
+ MUTEX_LOCK (session->lock);
+ if (session->in_select)
+ {
+ session->users++;
+ MUTEX_UNLOCK (session->lock);
+ MUTEX_UNLOCK (tcplock);
+ *tsessionPtr = session->tsession;
+ return OK;
+ }
+ MUTEX_UNLOCK (session->lock);
+ }
+ session = session->next;
+ }
+ }
MUTEX_UNLOCK (tcplock);
haddr = (Host6Address *) & hello[1];
memset (&hints, 0, sizeof (hints));
Modified: GNUnet/src/transports/udp_helper.c
===================================================================
--- GNUnet/src/transports/udp_helper.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/transports/udp_helper.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -145,7 +145,7 @@
*/
static int
udpConnect (const P2P_hello_MESSAGE * hello, TSession ** tsessionPtr,
- int may_reuse)
+ int may_reuse)
{
TSession *tsession;
Modified: GNUnet/src/util/network/io.c
===================================================================
--- GNUnet/src/util/network/io.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/util/network/io.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -141,14 +141,11 @@
{
#ifdef LINUX
unsigned int option;
- option = 1; /* 1s only */
- SETSOCKOPT(s->handle,
- IPPROTO_TCP,
- TCP_LINGER2,
- &option,
- sizeof(unsigned int));
-
-#endif
+ option = 1; /* 1s only */
+ SETSOCKOPT (s->handle,
+ IPPROTO_TCP, TCP_LINGER2, &option, sizeof (unsigned int));
+
+#endif
if ((0 != SHUTDOWN (s->handle, SHUT_RDWR)) &&
#ifdef OSX
(errno != EINVAL) && /* OS X returns these instead of ENOTCONN */
Modified: GNUnet/src/util/network/ipcheck.c
===================================================================
--- GNUnet/src/util/network/ipcheck.c 2007-07-29 07:14:25 UTC (rev 5364)
+++ GNUnet/src/util/network/ipcheck.c 2007-07-29 07:34:05 UTC (rev 5365)
@@ -185,19 +185,19 @@
=
htonl ((temps[0] << 24) + (temps[1] << 16) + (temps[2] << 8) +
temps[3]);
- result[i].netmask.addr = 0;
- while (slash > 0)
- {
- result[i].netmask.addr
- = (result[i].netmask.addr >> 1) + 0x80000000;
- slash--;
- }
- result[i].netmask.addr = htonl (result[i].netmask.addr);
- while (routeList[pos] != ';')
- pos++;
- pos++;
- i++;
- continue;
+ result[i].netmask.addr = 0;
+ while (slash > 0)
+ {
+ result[i].netmask.addr
+ = (result[i].netmask.addr >> 1) + 0x80000000;
+ slash--;
+ }
+ result[i].netmask.addr = htonl (result[i].netmask.addr);
+ while (routeList[pos] != ';')
+ pos++;
+ pos++;
+ i++;
+ continue;
}
GE_LOG (ectx,
GE_ERROR | GE_USER | GE_IMMEDIATE,
Modified: GNUnet/src/util/network/ipchecktest.c
===================================================================
--- GNUnet/src/util/network/ipchecktest.c 2007-07-29 07:14:25 UTC (rev
5364)
+++ GNUnet/src/util/network/ipchecktest.c 2007-07-29 07:34:05 UTC (rev
5365)
@@ -26,25 +26,23 @@
#include "gnunet_util.h"
#include "platform.h"
-int test()
+int
+test ()
{
- struct CIDRNetwork * cidr;
+ struct CIDRNetwork *cidr;
- cidr = parse_ipv4_network_specification(NULL,
- "127.0.0.1;");
+ cidr = parse_ipv4_network_specification (NULL, "127.0.0.1;");
if (cidr == NULL)
return 1;
- FREE(cidr);
- cidr = parse_ipv4_network_specification(NULL,
- "127.0.0.1/8;");
+ FREE (cidr);
+ cidr = parse_ipv4_network_specification (NULL, "127.0.0.1/8;");
if (cidr == NULL)
return 2;
- FREE(cidr);
- cidr = parse_ipv4_network_specification(NULL,
- "0.0.0.0/0;");
+ FREE (cidr);
+ cidr = parse_ipv4_network_specification (NULL, "0.0.0.0/0;");
if (cidr == NULL)
return 4;
- FREE(cidr);
+ FREE (cidr);
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5365 - in GNUnet/src: applications/chat applications/fs/module applications/sqstore_mysql applications/sqstore_sqlite applications/transport include server transports util/network,
gnunet <=