[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25053 - in gnunet/src: ats include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25053 - in gnunet/src: ats include |
Date: |
Mon, 19 Nov 2012 15:22:17 +0100 |
Author: wachs
Date: 2012-11-19 15:22:16 +0100 (Mon, 19 Nov 2012)
New Revision: 25053
Modified:
gnunet/src/ats/ats_api_performance.c
gnunet/src/include/gnunet_ats_service.h
Log:
- changes to api (not finished)
Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c 2012-11-19 14:17:51 UTC (rev
25052)
+++ gnunet/src/ats/ats_api_performance.c 2012-11-19 14:22:16 UTC (rev
25053)
@@ -106,6 +106,38 @@
/**
+ * Linked list of pending reservations.
+ */
+struct GNUNET_ATS_AddressListHandle
+{
+
+ /**
+ * Kept in a DLL.
+ */
+ struct GNUNET_ATS_AddressListHandle *next;
+
+ /**
+ * Kept in a DLL.
+ */
+ struct GNUNET_ATS_AddressListHandle *prev;
+
+ /**
+ * Target peer.
+ */
+ struct GNUNET_PeerIdentity peer;
+
+ /**
+ * Return all or specific peer only
+ */
+ int all_peers;
+
+ /**
+ * Return all or used address only
+ */
+ int all_addresses;
+};
+
+/**
* ATS Handle to obtain and/or modify performance information.
*/
struct GNUNET_ATS_PerformanceHandle
@@ -152,6 +184,16 @@
struct GNUNET_ATS_ReservationContext *reservation_tail;
/**
+ * Head of linked list of pending address list requests.
+ */
+ struct GNUNET_ATS_AddressListHandle *addresslist_head;
+
+ /**
+ * Tail of linked list of pending address list requests.
+ */
+ struct GNUNET_ATS_AddressListHandle *addresslist_tail;
+
+ /**
* Current request for transmission to ATS.
*/
struct GNUNET_CLIENT_TransmitHandle *th;
@@ -564,8 +606,61 @@
rc->rcb = NULL;
}
+/**
+ * Get information about addresses known to the ATS subsystem.
+ *
+ * @param cfg configuration to use
+ * @param peer peer idm can be NULL for all peers
+ * @param all GNUNET_YES to get information about all addresses or GNUNET_NO to
+ * get only address currently used
+ * @param infocb callback to call with the addresses,
+ * will callback with address == NULL when done
+ * @param infocb_cls closure for infocb
+ * @return ats performance context
+ */
+struct GNUNET_ATS_AddressListHandle*
+GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle
*handle,
+ const struct GNUNET_PeerIdentity *peer,
+ int all,
+ GNUNET_ATS_PeerInformationCallback
infocb,
+ void *infocb_cls)
+{
+ struct GNUNET_ATS_AddressListHandle *alh;
+ GNUNET_assert (NULL != handle);
+
+ alh = GNUNET_malloc (sizeof (struct GNUNET_ATS_AddressListHandle));
+ alh->all_addresses = all;
+ if (NULL == peer)
+ alh->all_peers = GNUNET_YES;
+ else
+ {
+ alh->all_peers = GNUNET_NO;
+ alh->peer = (*peer);
+ }
+
+ GNUNET_CONTAINER_DLL_insert (handle->addresslist_head,
handle->addresslist_tail, alh);
+
+ /* TODO */
+
+ return alh;
+}
+
+
/**
+ * Cancel a pending address listing operation
+ *
+ * @param handle the GNUNET_ATS_AddressListHandle handle to cancel
+ */
+void
+GNUNET_ATS_performance_list_addresses_cancel (struct
GNUNET_ATS_AddressListHandle *handle)
+{
+
+
+}
+
+
+/**
* Change preferences for the given peer. Preference changes are forgotten if
peers
* disconnect.
*
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2012-11-19 14:17:51 UTC (rev
25052)
+++ gnunet/src/include/gnunet_ats_service.h 2012-11-19 14:22:16 UTC (rev
25053)
@@ -690,7 +690,12 @@
GNUNET_ATS_Information *
ats, uint32_t ats_count);
+/**
+ * Handle for an address listing operation
+ */
+struct GNUNET_ATS_AddressListHandle;
+
/**
* Get handle to access performance API of the ATS subsystem.
*
@@ -706,6 +711,35 @@
/**
+ * Get information about addresses known to the ATS subsystem.
+ *
+ * @param cfg configuration to use
+ * @param peer peer idm can be NULL for all peers
+ * @param all GNUNET_YES to get information about all addresses or GNUNET_NO to
+ * get only address currently used
+ * @param infocb callback to call with the addresses,
+ * will callback with address == NULL when done
+ * @param infocb_cls closure for infocb
+ * @return ats performance context
+ */
+struct GNUNET_ATS_AddressListHandle *
+GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle
*handle,
+ const struct GNUNET_PeerIdentity *peer,
+ int all,
+ GNUNET_ATS_PeerInformationCallback
infocb,
+ void *infocb_cls);
+
+
+/**
+ * Cancel a pending address listing operation
+ *
+ * @param handle the GNUNET_ATS_AddressListHandle handle to cancel
+ */
+void
+GNUNET_ATS_performance_list_addresses_cancel (struct
GNUNET_ATS_AddressListHandle *handle);
+
+
+/**
* Client is done using the ATS performance subsystem, release resources.
*
* @param ph handle
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25053 - in gnunet/src: ats include,
gnunet <=