[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20811 - in gnunet/src: include transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20811 - in gnunet/src: include transport |
Date: |
Thu, 29 Mar 2012 15:18:50 +0200 |
Author: wachs
Date: 2012-03-29 15:18:50 +0200 (Thu, 29 Mar 2012)
New Revision: 20811
Modified:
gnunet/src/include/gnunet_transport_plugin.h
gnunet/src/transport/plugin_transport_unix.c
Log:
- mantis 2207 + docu
Modified: gnunet/src/include/gnunet_transport_plugin.h
===================================================================
--- gnunet/src/include/gnunet_transport_plugin.h 2012-03-29 13:08:34 UTC
(rev 20810)
+++ gnunet/src/include/gnunet_transport_plugin.h 2012-03-29 13:18:50 UTC
(rev 20811)
@@ -434,11 +434,9 @@
* @param cls closure ('struct Plugin*')
* @param addr string address
* @param addrlen length of the address
- * @param buf location to store a buffer pointer
+ * @param buf location to store the buffer
* If the function returns GNUNET_SYSERR, its contents are undefined.
- * @param max size of the buffer
- * @param buf_len location to store buffer size.
- * If the function returns GNUNET_SYSERR, its contents are undefined.
+ * @param added length of created address
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls,
Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c 2012-03-29 13:08:34 UTC
(rev 20810)
+++ gnunet/src/transport/plugin_transport_unix.c 2012-03-29 13:18:50 UTC
(rev 20811)
@@ -979,6 +979,42 @@
}
/**
+ * Function called to convert a string address to
+ * a binary address.
+ *
+ * @param cls closure ('struct Plugin*')
+ * @param addr string address
+ * @param addrlen length of the address
+ * @param buf location to store the buffer
+ * If the function returns GNUNET_SYSERR, its contents are undefined.
+ * @param added length of created address
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int
+unix_string_to_address (void *cls, const char *addr, uint16_t addrlen,
+ void **buf, size_t *added)
+{
+ if ((NULL == addr) || (addrlen == 0))
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+
+ if ((strlen (addr) + 1) != addrlen)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+
+ (*buf) = strdup (addr);
+ (*added) = strlen (addr) + 1;
+ return GNUNET_OK;
+}
+
+
+
+
+/**
* Function called for a quick conversion of the binary address to
* a numeric address. Note that the caller must not free the
* address and that the next call to this function is allowed
@@ -1058,10 +1094,13 @@
api->address_pretty_printer = &unix_plugin_address_pretty_printer;
api->address_to_string = &unix_address_to_string;
api->check_address = &unix_check_address;
+ api->string_to_address = &unix_string_to_address;
sockets_created = unix_transport_server_start (plugin);
if (sockets_created == 0)
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to open UNIX sockets\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("UNIX\n"));
+
plugin->session_map = GNUNET_CONTAINER_multihashmap_create(10);
GNUNET_SCHEDULER_add_now (address_notification, plugin);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20811 - in gnunet/src: include transport,
gnunet <=