diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-29 13:18:50 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-29 13:18:50 +0000 |
commit | a8c8084c4930be5ffd458f2fdda98f98b501e3df (patch) | |
tree | 7020a2377f5de21b47099881956c374c8e9f3537 /src/transport/plugin_transport_unix.c | |
parent | 7127dc5fc5c2a4ba9bc6f6cd8fade76b94fa907f (diff) | |
download | gnunet-a8c8084c4930be5ffd458f2fdda98f98b501e3df.tar.gz gnunet-a8c8084c4930be5ffd458f2fdda98f98b501e3df.zip |
- mantis 2207 + docu
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r-- | src/transport/plugin_transport_unix.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 51fbcd081..fa7783b9e 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -979,6 +979,42 @@ unix_plugin_address_pretty_printer (void *cls, const char *type, | |||
979 | } | 979 | } |
980 | 980 | ||
981 | /** | 981 | /** |
982 | * Function called to convert a string address to | ||
983 | * a binary address. | ||
984 | * | ||
985 | * @param cls closure ('struct Plugin*') | ||
986 | * @param addr string address | ||
987 | * @param addrlen length of the address | ||
988 | * @param buf location to store the buffer | ||
989 | * If the function returns GNUNET_SYSERR, its contents are undefined. | ||
990 | * @param added length of created address | ||
991 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | ||
992 | */ | ||
993 | int | ||
994 | unix_string_to_address (void *cls, const char *addr, uint16_t addrlen, | ||
995 | void **buf, size_t *added) | ||
996 | { | ||
997 | if ((NULL == addr) || (addrlen == 0)) | ||
998 | { | ||
999 | GNUNET_break (0); | ||
1000 | return GNUNET_SYSERR; | ||
1001 | } | ||
1002 | |||
1003 | if ((strlen (addr) + 1) != addrlen) | ||
1004 | { | ||
1005 | GNUNET_break (0); | ||
1006 | return GNUNET_SYSERR; | ||
1007 | } | ||
1008 | |||
1009 | (*buf) = strdup (addr); | ||
1010 | (*added) = strlen (addr) + 1; | ||
1011 | return GNUNET_OK; | ||
1012 | } | ||
1013 | |||
1014 | |||
1015 | |||
1016 | |||
1017 | /** | ||
982 | * Function called for a quick conversion of the binary address to | 1018 | * Function called for a quick conversion of the binary address to |
983 | * a numeric address. Note that the caller must not free the | 1019 | * a numeric address. Note that the caller must not free the |
984 | * address and that the next call to this function is allowed | 1020 | * address and that the next call to this function is allowed |
@@ -1058,10 +1094,13 @@ libgnunet_plugin_transport_unix_init (void *cls) | |||
1058 | api->address_pretty_printer = &unix_plugin_address_pretty_printer; | 1094 | api->address_pretty_printer = &unix_plugin_address_pretty_printer; |
1059 | api->address_to_string = &unix_address_to_string; | 1095 | api->address_to_string = &unix_address_to_string; |
1060 | api->check_address = &unix_check_address; | 1096 | api->check_address = &unix_check_address; |
1097 | api->string_to_address = &unix_string_to_address; | ||
1061 | sockets_created = unix_transport_server_start (plugin); | 1098 | sockets_created = unix_transport_server_start (plugin); |
1062 | if (sockets_created == 0) | 1099 | if (sockets_created == 0) |
1063 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to open UNIX sockets\n")); | 1100 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to open UNIX sockets\n")); |
1064 | 1101 | ||
1102 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("UNIX\n")); | ||
1103 | |||
1065 | plugin->session_map = GNUNET_CONTAINER_multihashmap_create(10); | 1104 | plugin->session_map = GNUNET_CONTAINER_multihashmap_create(10); |
1066 | 1105 | ||
1067 | GNUNET_SCHEDULER_add_now (address_notification, plugin); | 1106 | GNUNET_SCHEDULER_add_now (address_notification, plugin); |