aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-08-23 07:29:40 +0000
committerwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-08-23 07:29:40 +0000
commitca386c703fff1a1be492b438d3793a44f11b432a (patch)
tree0919aa6db2a7394304a7ce82ba25106d750822e1 /src/transport
parentd38eb3db38c7bd9baf5f5dcc41a474bb396611a6 (diff)
changes to plugin test
git-svn-id: https://gnunet.org/svn/gnunet@23372 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/test_plugin_transport.c67
1 files changed, 50 insertions, 17 deletions
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index 55dfb40a16..2cce506225 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -25,6 +25,7 @@
*/
#include "platform.h"
+#include "gnunet_common.h"
#include "gnunet_constants.h"
#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
@@ -82,7 +83,7 @@ static int ok;
/**
*/
static void
-receive (void *cls, const struct GNUNET_PeerIdentity *peer,
+env_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message, uint32_t distance,
const char *sender_address, size_t sender_address_len)
{
@@ -90,11 +91,38 @@ receive (void *cls, const struct GNUNET_PeerIdentity *peer,
}
void
-notify_address (void *cls, const char *name, const void *addr, size_t addrlen,
+env_notify_address (void *cls, const char *name, const void *addr, size_t addrlen,
struct GNUNET_TIME_Relative expires)
{
}
+struct GNUNET_ATS_Information
+env_get_address_type (void *cls,
+ const struct sockaddr *addr,
+ size_t addrlen)
+{
+ struct GNUNET_ATS_Information ats;
+ ats.type = htonl (0);
+ ats.value = htonl (0);
+ return ats;
+}
+
+
+const struct GNUNET_MessageHeader *
+env_get_our_hello (void)
+{
+ GNUNET_break (0);
+ return NULL;
+}
+
+void env_session_end (void *cls,
+ const struct GNUNET_PeerIdentity *peer,
+ struct Session * session)
+{
+
+}
+
+
/**
* Function called when the service shuts
* down. Unloads our plugins.
@@ -161,11 +189,16 @@ static void
setup_plugin_environment ()
{
env.cfg = cfg;
- env.my_identity = &my_identity;
env.cls = &env;
- env.receive = &receive;
- env.notify_address = &notify_address;
+ env.my_identity = &my_identity;
env.max_connections = max_connect_per_transport;
+ env.stats = NULL;
+
+ env.receive = &env_receive;
+ env.notify_address = &env_notify_address;
+ env.get_address_type = &env_get_address_type;
+ env.get_our_hello = &env_get_our_hello;
+ env.session_end = &env_session_end;
}
@@ -179,23 +212,24 @@ static void
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+#if 0
unsigned long long tneigh;
char *keyfile;
char *libname;
cfg = c;
/* parse configuration */
- if ((GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "TRANSPORT", "NEIGHBOUR_LIMIT",
- &tneigh)) ||
- (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_filename (c, "GNUNETD", "HOSTKEY",
- &keyfile)))
+ if ((GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (c,
+ "TRANSPORT",
+ "NEIGHBOUR_LIMIT",
+ &tneigh)) ||
+ (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (c,
+ "GNUNETD", "HOSTKEY",
+ &keyfile)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _
- ("Transport service is lacking key configuration settings. Exiting.\n"));
- GNUNET_SCHEDULER_shutdown (s);
+ _("Transport service is lacking key configuration settings. Exiting.\n"));
+ GNUNET_SCHEDULER_shutdown ();
return;
}
max_connect_per_transport = (uint32_t) tneigh;
@@ -205,15 +239,13 @@ run (void *cls, char *const *args, const char *cfgfile,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Transport service could not access hostkey. Exiting.\n"));
- GNUNET_SCHEDULER_shutdown (s);
+ GNUNET_SCHEDULER_shutdown ();
return;
}
GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &my_public_key);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&my_identity.hashPubKey);
-
-
/* load plugins... */
setup_plugin_environment ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading tcp transport plugin\n"));
@@ -229,6 +261,7 @@ run (void *cls, char *const *args, const char *cfgfile,
return;
}
test_validation ();
+#endif
}