create_listen_socket (struct sockaddr *sa, socklen_t addr_len,
struct ServiceList *sl)
{
- const static int on = 1;
+ static int on = 1;
struct GNUNET_NETWORK_Handle *sock;
struct ServiceListeningInfo *sli;
double D;
double R;
double U;
- long long unsigned int tmp;
+ unsigned long long tmp;
unsigned int b_min;
unsigned int n_min;
struct GNUNET_TIME_Relative i_exec;
/**
* If there are at least this many connections, old ones will be removed
*/
-static long long unsigned int max_connections;
+static unsigned long long max_connections;
/**
* This hashmaps saves interesting things about the configured UDP services
const struct GNUNET_FS_Uri *uri)
{
char *ret;
- char *name, *unique_name;
+ char *name;
+ char *unique_name;
if (uri->type != sks)
return NULL;
static void *
progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
{
- char *s, *s2;
+ char *s;
+ char *s2;
char *t;
switch (info->status)
const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
- char *id, *unique_id;
+ char *id;
+ char *unique_id;
int getinfo_result;
/* While we get a name from the caller, it might be NULL.
struct GNUNET_NETWORK_FDSet *wws;
struct GNUNET_NETWORK_FDSet *wes;
int max;
- unsigned MHD_LONG_LONG timeout;
+ MHD_LONG_LONG timeout;
int haveto;
struct GNUNET_TIME_Relative tv;
char *pos;
char *secname;
int counter;
- long long unsigned int port;
+ unsigned long long port;
have_tcp = GNUNET_NO;
have_udp = GNUNET_NO;
{
/* FIXME are hashes in multihash map equal on all aquitectures? */
/* FIXME: keep return value of 'put' to possibly cancel!? */
- GNUNET_DHT_put (dht_handle, key, 10U,
+ GNUNET_DHT_put (dht_handle, key, 10,
GNUNET_DHT_RO_RECORD_ROUTE |
GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, GNUNET_BLOCK_TYPE_TEST,
sizeof (struct GNUNET_PeerIdentity),
(char *) &my_full_id, /* Data itself */
GNUNET_TIME_absolute_get_forever (), /* Data expiration */
GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */
-#if MESH_DEBUG_DHT
- &mesh_debug, "DHT_put for id completed");
-#else
NULL, /* Continuation */
NULL); /* Continuation closure */
-#endif
announce_id_task =
GNUNET_SCHEDULER_add_delayed (ID_ANNOUNCE_TIME, &announce_id, cls);
}
* - SEND FUNCTIONS
* - API CALL DEFINITIONS
*/
-#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
#include "platform.h"
#include "gnunet_common.h"
#include "gnunet_client_lib.h"
#include "mesh.h"
#include "mesh_protocol.h"
-#define MESH_API_DEBUG GNUNET_YES
-
-#if MESH_API_DEBUG
#define LOG(kind,...) GNUNET_log_from (kind, "mesh-api",__VA_ARGS__)
-#else
-#define LOG(kind,...)
-#endif
+
/******************************************************************************/
/************************ DATA STRUCTURES ****************************/
}
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
* frequency limits to SMTP in the future!).
*/
static int
-api_test_would_try (GNUNET_TSession * tsession, const unsigned int size,
+api_test_would_try (GNUNET_TSession * tsession, unsigned int size,
int important)
{
return GNUNET_OK; /* we always try... */
* returns the smtp transport API.
*/
GNUNET_TransportAPI *
-inittransport_smtp (GNUNET_CoreAPIForTransport * core)
+inittransport_smtp (struct GNUNET_CoreAPIForTransport * core)
{
-
-
unsigned long long mtu;
struct sigaction sa;
ssize_t sent;
size_t slen;
struct GNUNET_TIME_Absolute max;
- struct GNUNET_TIME_Absolute ;
-
struct UDPMessageWrapper *udpw = NULL;
if (sock == plugin->sockv4)
* have a valid global IPv6 address assigned
*/
LOG (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- _("UDP could not message to `%s': `%s'\n, " \
- "Please check your network configuration and disable IPv6 if your\n" \
- "connection does not have a global IPv6 address"),
+ _("UDP could not message to `%s': `%s'. "
+ "Please check your network configuration and disable IPv6 if your "
+ "connection does not have a global IPv6 address\n"),
GNUNET_a2s (sa, slen),
STRERROR (errno));
}
gnunet_force_log_parsed = GNUNET_YES;
}
#endif
+
+
/**
* Setup logging.
*
if (NULL == fn)
return GNUNET_SYSERR;
dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
- altlog_fd = OPEN (fn, O_APPEND |
#if WINDOWS
+ altlog_fd = OPEN (fn, O_APPEND |
O_BINARY |
-#endif
O_WRONLY | O_CREAT,
-#if WINDOWS
- _S_IREAD | _S_IWRITE
+ _S_IREAD | _S_IWRITE);
#else
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+ altlog_fd = OPEN (fn, O_APPEND |
+ O_WRONLY | O_CREAT,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
#endif
- );
if (altlog_fd != -1)
{
int dup_return;
return GNUNET_NO;
}
+typedef int (*Comparator)(const void *, size_t, const void *, size_t);
/**
* Check if a list contains a certain element
void *
GNUNET_CONTAINER_slist_contains2 (const struct GNUNET_CONTAINER_SList *l,
const void *buf, size_t len,
- int (*compare)(const void *, const size_t, const void *, const size_t))
+ Comparator compare)
{
struct GNUNET_CONTAINER_SList_Elem *e;
}
#ifdef MINGW
- LARGE_INTEGER li, new_pos;
+ LARGE_INTEGER li;
+ LARGE_INTEGER new_pos;
BOOL b;
static DWORD t[] = {[GNUNET_DISK_SEEK_SET] = FILE_BEGIN,
getenv ();
static char *
-my_index (str, chr)
- const char *str;
- int chr;
+my_index (const char *str,
+ int chr)
{
while (*str)
{
#endif
static void
-exchange (argv)
- char **argv;
+exchange (char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
-_getopt_initialize (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
+_getopt_initialize (int argc,
+ char *const *argv,
+ const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
* is the program name); the sequence of previously skipped
error = ioctl (desc->fd, FIONREAD, &pending);
if (error == 0)
+ return (ssize_t) pending;
+ return GNUNET_NO;
#else
u_long pending;
error = ioctlsocket (desc->fd, FIONREAD, &pending);
if (error != SOCKET_ERROR)
+ return (ssize_t) pending;
+ return GNUNET_NO;
#endif
- return pending;
- else
- return GNUNET_NO;
}
const struct GNUNET_TIME_Relative timeout)
{
int nfds = 0;
-
#ifdef MINGW
int handles = 0;
int ex_handles = 0;
int retcode = 0;
DWORD ms_total = 0;
- int nsock = 0, nhandles = 0, nSockEvents = 0;
+ int nsock = 0;
+ int nhandles = 0;
+ int nSockEvents = 0;
static HANDLE hEventRead = 0;
static HANDLE hEventWrite = 0;
DWORD newretcode = 0;
int returnedpos = 0;
- struct GNUNET_CONTAINER_SList *handles_read, *handles_write, *handles_except;
+ struct GNUNET_CONTAINER_SList *handles_read;
+ struct GNUNET_CONTAINER_SList *handles_write;
+ struct GNUNET_CONTAINER_SList *handles_except;
- fd_set aread, awrite, aexcept;
+ fd_set aread;
+ fd_set awrite;
+ fd_set except;
#if DEBUG_NETWORK
- fd_set bread, bwrite, bexcept;
+ fd_set bread;
+ fd_set bwrite;
+ fd_set bexcept;
#endif
/* TODO: Make this growable */
static char *
CreateCustomEnvTable (char **vars)
{
- char *win32_env_table, *ptr, **var_ptr, *result, *result_ptr;
+ char *win32_env_table;
+ char *ptr;
+ char **var_ptr;
+ char *result;
+ char *result_ptr;
size_t tablesize = 0;
size_t items_count = 0;
- size_t n_found = 0, n_var;
+ size_t n_found = 0;
+ size_t n_var;
char *index = NULL;
size_t c;
size_t var_len;
* @param a2 second command line option
*/
static int
-cmd_sorter (__const void *a1, __const void *a2)
+cmd_sorter (const void *a1, const void *a2)
{
- __const struct GNUNET_GETOPT_CommandLineOption *c1 = a1;
- __const struct GNUNET_GETOPT_CommandLineOption *c2 = a2;
+ const struct GNUNET_GETOPT_CommandLineOption *c1 = a1;
+ const struct GNUNET_GETOPT_CommandLineOption *c2 = a2;
if (toupper ((unsigned char) c1->shortName) >
toupper ((unsigned char) c2->shortName))
int32_t rating;
struct GNUNET_CONTAINER_MetaData *meta;
const char *fn;
- char *str, *name_unique;
+ char *str;
+ char *name_unique;
if (strlen (fullname) < sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded))
return GNUNET_OK;
static struct GNUNET_NETWORK_Handle *
open_listen_socket (const struct sockaddr *serverAddr, socklen_t socklen)
{
- const static int on = 1;
+ static int on = 1;
struct GNUNET_NETWORK_Handle *sock;
uint16_t port;
int eno;