* @param cls closure ('struct Plugin*')
* @param addr string address
* @param addrlen length of the address
- * @param buf location to store a buffer pointer
- * If the function returns GNUNET_SYSERR, its contents are undefined.
- * @param max size of the buffer
- * @param buf_len location to store buffer size.
+ * @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
*/
typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls,
}
+/**
+ * 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
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);