*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
-/**
- * Our server.
- */
-static struct GNUNET_SERVER_Handle *server;
-
/**
* Transport service.
*/
*
* @param cls closure
* @param s scheduler to use
- * @param serv the initialized server
+ * @param server the initialized server
* @param c configuration to use
*/
static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
- struct GNUNET_SERVER_Handle *serv,
+ struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
GNUNET_CRYPTO_hash (&my_public_key,
sizeof (my_public_key), &my_identity.hashPubKey);
/* setup notification */
- server = serv;
notifier = GNUNET_SERVER_notification_context_create (server,
MAX_NOTIFY_QUEUE);
GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
*/
static struct GNUNET_CONTAINER_BloomFilter *filter;
-/**
- * Static counter to produce reservation identifiers.
- */
-static int reservation_gen;
-
/**
* How much space are we allowed to use?
*/
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+ /**
+ * Static counter to produce reservation identifiers.
+ */
+ static int reservation_gen;
+
const struct ReserveMessage *msg = (const struct ReserveMessage*) message;
struct ReservationList *e;
unsigned long long used;
/* **************************** Startup ************************ */
-
-/**
- * List of handlers for P2P messages
- * that we care about.
- */
-static struct GNUNET_CORE_MessageHandler p2p_handlers[] =
- {
- { &handle_p2p_get,
- GNUNET_MESSAGE_TYPE_FS_GET, 0 },
- { &handle_p2p_put,
- GNUNET_MESSAGE_TYPE_FS_PUT, 0 },
- { NULL, 0, 0 }
- };
-
-
-/**
- * List of handlers for the messages understood by this
- * service.
- */
-static struct GNUNET_SERVER_MessageHandler handlers[] = {
- {&GNUNET_FS_handle_index_start, NULL,
- GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0},
- {&GNUNET_FS_handle_index_list_get, NULL,
- GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, sizeof(struct GNUNET_MessageHeader) },
- {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX,
- sizeof (struct UnindexMessage) },
- {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH,
- 0 },
- {NULL, NULL, 0, 0}
-};
-
-
/**
* Process fs requests.
*
struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ static const struct GNUNET_CORE_MessageHandler p2p_handlers[] =
+ {
+ { &handle_p2p_get,
+ GNUNET_MESSAGE_TYPE_FS_GET, 0 },
+ { &handle_p2p_put,
+ GNUNET_MESSAGE_TYPE_FS_PUT, 0 },
+ { NULL, 0, 0 }
+ };
+ static const struct GNUNET_SERVER_MessageHandler handlers[] = {
+ {&GNUNET_FS_handle_index_start, NULL,
+ GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0},
+ {&GNUNET_FS_handle_index_list_get, NULL,
+ GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, sizeof(struct GNUNET_MessageHeader) },
+ {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX,
+ sizeof (struct UnindexMessage) },
+ {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH,
+ 0 },
+ {NULL, NULL, 0, 0}
+ };
+
sched = s;
cfg = c;
stats = GNUNET_STATISTICS_create (sched, "fs", cfg);
/**
* Handle to hostlist server's connect handler
*/
-static GNUNET_CORE_ConnectEventHandler server_ch = NULL;
+static GNUNET_CORE_ConnectEventHandler server_ch;
/**
* Handle to hostlist server's disconnect handler
*/
-static GNUNET_CORE_DisconnectEventHandler server_dh = NULL;
+static GNUNET_CORE_DisconnectEventHandler server_dh;
#endif
*/
static int advertising;
-/**
- * How many times was the hostlist advertised?
- */
-static uint64_t hostlist_adv_count;
-
/**
* Buffer for the hostlist address
*/
static size_t
adv_transmit_ready ( void *cls, size_t size, void *buf)
{
+ static uint64_t hostlist_adv_count;
+
size_t transmission_size;
size_t uri_size; /* Including \0 termination! */
struct GNUNET_MessageHeader header;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
" # Sent advertisement message: %u\n",
hostlist_adv_count);
- GNUNET_STATISTICS_set (stats,
- gettext_noop("# hostlist advertisements send"),
- hostlist_adv_count,
- GNUNET_NO);
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop("# hostlist advertisements send"),
+ 1,
+ GNUNET_NO);
return transmission_size;
}
*/
static struct StatsEntry *start;
-/**
- * Counter used to generate unique values.
- */
-static uint32_t uidgen;
-
/**
* Load persistent values from disk. Disk format is
* exactly the same format that we also use for
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+ /**
+ * Counter used to generate unique values.
+ */
+ static uint32_t uidgen;
+
char *service;
char *name;
uint16_t msize;
static struct in_addr dummy;
-static struct in_addr target;
-
static uint32_t port;
static uint16_t
main (int argc, char *const *argv)
{
struct in_addr external;
+ struct in_addr target;
uid_t uid;
if (-1 == (rawsock = make_raw_socket()))
*/
static struct GNUNET_HELLO_Message *our_hello;
-/**
- * "version" of "our_hello". Used to see if a given neighbour has
- * already been sent the latest version of our HELLO message.
- */
-static unsigned int our_hello_version;
-
/**
* Our public key.
*/
*/
static struct TransportPlugin *plugins;
-/**
- * Our server.
- */
-static struct GNUNET_SERVER_Handle *server;
-
/**
* Handle to peerinfo service.
*/
GNUNET_free_non_null (our_hello);
our_hello = hello;
- our_hello_version++;
GNUNET_PEERINFO_add_peer (peerinfo, our_hello);
npos = neighbours;
while (npos != NULL)
*
* @param cls closure
* @param s scheduler to use
- * @param serv the initialized server
+ * @param server the initialized server
* @param c configuration to use
*/
static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
- struct GNUNET_SERVER_Handle *serv,
+ struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
GNUNET_CRYPTO_hash (&my_public_key,
sizeof (my_public_key), &my_identity.hashPubKey);
/* setup notification */
- server = serv;
GNUNET_SERVER_disconnect_notify (server,
&client_disconnect_notification, NULL);
/* load plugins... */