fix more leaks
[oweals/gnunet.git] / src / transport / plugin_transport_template.c
index e8874d14ea50c272555e423faf74f21711bbaabc..dedc8e85789542868cdb4e213d790f09f6de1051 100644 (file)
  */
 
 #include "platform.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet_transport_service.h"
 #include "gnunet_transport_plugin.h"
@@ -107,7 +105,7 @@ struct Session
 
 };
 
-#define GNUNET_NETWORK_STRUCT_BEGIN
+GNUNET_NETWORK_STRUCT_BEGIN
 
 struct TemplateAddress
 {
@@ -205,6 +203,7 @@ template_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
   // FIXME
 }
 
+
 /**
  * Function obtain the network type for a session
  *
@@ -213,13 +212,14 @@ template_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
  * @return the network type in HBO or GNUNET_SYSERR
  */
 static enum GNUNET_ATS_Network_Type
-template_plugin_get_network (void *cls, void *session)
+template_plugin_get_network (void *cls,
+                            struct Session *session)
 {
-       struct Session *s = (struct Session *) session;
-       GNUNET_assert (NULL != s);
-       return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */
+  GNUNET_assert (NULL != session);
+  return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */
 }
 
+
 /**
  * Convert the transports address to a nice, human-readable
  * format.
@@ -242,6 +242,11 @@ template_plugin_address_pretty_printer (void *cls, const char *type,
                                         GNUNET_TRANSPORT_AddressStringCallback
                                         asc, void *asc_cls)
 {
+       if (0 == addrlen)
+       {
+               asc (asc_cls, TRANSPORT_SESSION_INBOUND_STRING);
+       }
+
   asc (asc_cls, NULL);
 }
 
@@ -284,9 +289,14 @@ static const char *
 template_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
 {
        /*
-        * Parse string in format template.options.address
+        * Print address in format template.options.address
         */
 
+       if (0 == addrlen)
+       {
+               return TRANSPORT_SESSION_INBOUND_STRING;
+       }
+
   GNUNET_break (0);
   return NULL;
 }
@@ -310,9 +320,10 @@ template_plugin_string_to_address (void *cls, const char *addr, uint16_t addrlen
 {
 
        /*
-        * Print address in format template.options.address
+        * Parse string in format template.options.address
         */
 
+
   GNUNET_break (0);
   return GNUNET_SYSERR;
 }