/**
- * Function to call with a binary format of an address
+ * Function to call with a textual representation of an address.
+ * This function will be called several times with different possible
+ * textual representations, and a last time with NULL to signal the end
+ * of the iteration.
*
* @param cls closure
- * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
+ * @param address NULL on error or end of iteration,
+ * otherwise 0-terminated printable UTF-8 string
*/
-// RENAME: AddressToStringCallback
-typedef void (*GNUNET_TRANSPORT_AddressLookUpCallback) (void *cls,
- const char *address);
+typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
+ const char *address);
/**
* Function to call with a binary format of an address
*
* @param cls closure
- * @param peer peer identity
- * @param transport transport plugin
- * @param addr address
- * @param addrlen address length
+ * @param peer peer this update is about (never NULL)
+ * @param address address, NULL for disconnect notification in monitor mode
*/
-// FIXME: use GNUNET_HELLO_Address (as 2nd arg, replacing others)
-// FIXME: rename: remove "Binary"
-// FIXME: use NULL for address on disconnect IF in monitor mode (one_shot = NO)
-typedef void (*GNUNET_TRANSPORT_AddressLookUpBinaryCallback) (void *cls,
- const struct
- GNUNET_PeerIdentity
- * peer,
- const char
- *transport,
- const void *addr,
- size_t addrlen);
+typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) (void *cls,
+ const struct
+ GNUNET_PeerIdentity *
+ peer,
+ const struct
+ GNUNET_HELLO_Address *
+ address);
/**
/**
* Handle to cancel a pending address lookup.
*/
-struct GNUNET_TRANSPORT_AddressLookupContext;
+struct GNUNET_TRANSPORT_AddressToStringContext;
/**
*
* @param cfg configuration to use
* @param address address to convert (binary format)
- * @param addressLen number of bytes in address
* @param numeric should (IP) addresses be displayed in numeric form
* (otherwise do reverse DNS lookup)
- * @param nameTrans name of the transport to which the address belongs
* @param timeout how long is the lookup allowed to take at most
* @param aluc function to call with the results
* @param aluc_cls closure for aluc
* @return handle to cancel the operation, NULL on error
*/
-// FIXME: use 'GNUNET_HELLO_Address' here!
-// => rename: address_to_string
-struct GNUNET_TRANSPORT_AddressLookupContext *
-GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *address, size_t addressLen,
- int numeric, const char *nameTrans,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_AddressLookUpCallback aluc,
- void *aluc_cls);
+struct GNUNET_TRANSPORT_AddressToStringContext *
+GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle
+ *cfg,
+ const struct GNUNET_HELLO_Address *address,
+ int numeric,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TRANSPORT_AddressToStringCallback
+ aluc, void *aluc_cls);
/**
* @param alc handle for the request to cancel
*/
void
-GNUNET_TRANSPORT_address_lookup_cancel (struct
- GNUNET_TRANSPORT_AddressLookupContext
- *alc);
-
-
-/**
- * Handle to cancel a pending address lookup.
- */
-struct GNUNET_TRANSPORT_AddressLookupContext;
+GNUNET_TRANSPORT_address_to_string_cancel (struct
+ GNUNET_TRANSPORT_AddressToStringContext
+ *alc);
/**
- * Return all the known addresses for a peer. FIXME: document better!
- * FIXME: use better name!
+ * Return all the known addresses for a specific peer or all peers.
+ * Returns continuously all address if one_shot is set to GNUNET_NO
+ *
* CHANGE: Returns the address(es) that we are currently using for this
* peer. Upon completion, the 'AddressLookUpCallback' is called one more
* time with 'NULL' for the address and the peer. After this, the operation must no
* longer be explicitly cancelled.
- * TODO: change code that uses this API to see if this is fine...
*
* @param cfg configuration to use
* @param peer peer identity to look up the addresses of, CHANGE: allow NULL for all (connected) peers
- * FIXME: @param one_shot GNUNET_YES to return the current state and then end (with NULL+NULL),
- * GNUNET_NO to monitor the set of addresses used (continuously, must be explicitly cancelled)
+ * @param one_shot GNUNET_YES to return the current state and then end (with NULL+NULL),
+ * GNUNET_NO to monitor the set of addresses used (continuously, must be explicitly canceled, NOT implemented yet!)
* @param timeout how long is the lookup allowed to take at most
* @param peer_address_callback function to call with the results
* @param peer_address_callback_cls closure for peer_address_callback
*/
-// RENAME: peer_get_active_addresses
-struct GNUNET_TRANSPORT_PeerAddressLookupContext *
-GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle
- *cfg,
- const struct GNUNET_PeerIdentity *peer,
- // FIXME: add argument: one_shot
- struct GNUNET_TIME_Relative timeout,
- // FIXME: change to the 'Binary' lookup callback (which will
- // be renamed, so the argument type actually won't change)
- GNUNET_TRANSPORT_AddressLookUpCallback
- peer_address_callback,
- void *peer_address_callback_cls);
+struct GNUNET_TRANSPORT_PeerIterateContext *
+GNUNET_TRANSPORT_peer_get_active_addresses (const struct
+ GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_PeerIdentity
+ *peer, int one_shot,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TRANSPORT_PeerIterateCallback
+ peer_address_callback,
+ void *peer_address_callback_cls);
/**
* @param alc handle for the request to cancel
*/
void
-GNUNET_TRANSPORT_peer_address_lookup_cancel (struct
- GNUNET_TRANSPORT_PeerAddressLookupContext
- *alc);
-
-
-/**
- * Return all the known addresses. FIXME: document better!
- *
- * FIXME: remove, replace with new 'peer_address_lookup' API
- *
- *
- * @param cfg configuration to use
- * @param timeout how long is the lookup allowed to take at most
- * @param peer_address_callback function to call with the results
- * @param peer_address_callback_cls closure for peer_address_callback
- */
-void
-GNUNET_TRANSPORT_address_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_AddressLookUpBinaryCallback
- peer_address_callback,
- void *peer_address_callback_cls);
+GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
+ GNUNET_TRANSPORT_PeerIterateContext
+ *alc);
/**
*
* @param cls closure
* @param pid peer to approve or disapproave
- * @return GNUNET_OK if the connection is allowed
+ * @return GNUNET_OK if the connection is allowed, GNUNET_SYSERR if not
*/
typedef int (*GNUNET_TRANSPORT_BlacklistCallback) (void *cls,
const struct