/**
* Enum defining all known preference categories.
+ *
+ * @deprecated will be replaced by `enum GNUNET_MQ_PriorityPreference`
*/
enum GNUNET_MQ_PreferenceKind
{
*
* @param type the preference type
* @return a string or NULL if invalid
+ *
+ * @deprecated will be replaced by `enum GNUNET_MQ_PriorityPreference`
*/
const char *
GNUNET_MQ_preference_to_string (enum GNUNET_MQ_PreferenceKind type);
/**
* @author Christian Grothoff
*
+ * @deprecated NOTE: we may want to drop this API and
+ * only keep the gnunet_transport_application_service.h in the future!
+ *
* @file
* Provide addresses to transport for validation
*
#define GNUNET_TRANSPORT_ADDRESS_SERVICE_H
#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
* @return NULL on error
*/
struct GNUNET_TRANSPORT_AddressHandle *
-GNUNET_TRANSPORT_address_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
+GNUNET_TRANSPORT_address_connect (
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
const size_t raw_size);
-#if 0 /* keep Emacsens' auto-indent happy */
+#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
/* ifndef GNUNET_TRANSPORT_ADDRESS_SERVICE_H */
#endif
-/** @} */ /* end of group */
+/** @} */ /* end of group */
/* end of gnunet_transport_address_service.h */
struct GNUNET_TRANSPORT_ApplicationHandle *ch);
+/**
+ * An application would like TRANSPORT to connect to a peer.
+ *
+ * @param ch handle
+ * @param peer identity of the peer we need an address for
+ * @param pk what kind of application will the application require (can be
+ * #GNUNET_MQ_PRIO_BACKGROUND, we will still try to connect)
+ * @param bw desired bandwith, can be zero (we will still try to connect)
+ * @return suggest handle, NULL if a request is already pending
+ */
+struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
+GNUNET_TRANSPORT_application_suggest (
+ struct GNUNET_TRANSPORT_ApplicationHandle *ch,
+ const struct GNUNET_PeerIdentity *peer,
+ enum GNUNET_MQ_PriorityPreferences pk,
+ struct GNUNET_BANDWIDTH_Value32NBO bw);
+
+
+/**
+ * We no longer care about being connected to a peer.
+ *
+ * @param sh handle to stop
+ */
+void
+GNUNET_TRANSPORT_application_suggest_cancel (
+ struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh);
+
+
/**
* An application (or a communicator) has received a HELLO (or other address
* data of another peer) and wants TRANSPORT to validate that the address is
* @file
* obtain information about our current address
*
+ * @deprecated, in TNG applications should query PEERSTORE directly!
+ *
* @defgroup transport Transport service
* address information
*
#define GNUNET_TRANSPORT_HELLO_SERVICE_H
#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
* @param cls closure
* @param hello our updated HELLO
*/
-typedef void
-(*GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls,
- const struct GNUNET_MessageHeader *hello);
+typedef void (*GNUNET_TRANSPORT_HelloUpdateCallback) (
+ void *cls,
+ const struct GNUNET_MessageHeader *hello);
/**
* @param nt network type of the address
* @param expiration when does this address expire?
*/
-typedef void
-(*GNUNET_TRANSPORT_AddressCallback) (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const char *address,
- enum GNUNET_NetworkType nt,
- struct GNUNET_TIME_Absolute expiration);
+typedef void (*GNUNET_TRANSPORT_AddressCallback) (
+ void *cls,
+ const struct GNUNET_PeerIdentity *peer,
+ const char *address,
+ enum GNUNET_NetworkType nt,
+ struct GNUNET_TIME_Absolute expiration);
/**
void *cb_cls);
-#if 0 /* keep Emacsens' auto-indent happy */
+#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
/* ifndef GNUNET_TRANSPORT_HELLO_SERVICE_H */
#endif
-/** @} */ /* end of group */
+/** @} */ /* end of group */
/* end of gnunet_transport_hello_service.h */
/**
* What kind of performance preference does this @e tc have?
+ *
+ * TODO: use this!
*/
- enum GNUNET_MQ_PreferenceKind pk;
+ enum GNUNET_MQ_PriorityPreferences pk;
/**
* How much bandwidth would this @e tc like to see?
*/
enum PendingMessageType pmt;
+ /**
+ * Preferences for this message.
+ * TODO: actually use this!
+ */
+ enum GNUNET_MQ_PriorityPreferences prefs;
+
/**
* Size of the original message.
*/
obmm = (const struct GNUNET_MessageHeader *) &obm[1];
bytes_msg = ntohs (obmm->size);
pp = (enum GNUNET_MQ_PriorityPreferences) ntohl (obm->priority);
- /* FIXME: actually make use of pp */ (void) pp;
vl = GNUNET_CONTAINER_multipeermap_get (links, &obm->peer);
if (NULL == vl)
{
was_empty = (NULL == target->pending_msg_head);
pm = GNUNET_malloc (sizeof (struct PendingMessage) + payload_size);
+ pm->prefs = pp;
pm->client = tc;
pm->target = target;
pm->bytes_msg = payload_size;
pr->tc = tc;
pr->pid = msg->peer;
pr->bw = msg->bw;
- pr->pk = (enum GNUNET_MQ_PreferenceKind) ntohl (msg->pk);
+ pr->pk = (enum GNUNET_MQ_PriorityPreferences) ntohl (msg->pk);
if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_put (
tc->details.application.requests,
&pr->pid,
#include "gnunet_ats_transport_service.h"
#include "transport.h"
-#define LOG(kind,...) GNUNET_log_from (kind, "transport-api-address",__VA_ARGS__)
+#define LOG(kind, ...) \
+ GNUNET_log_from (kind, "transport-api-address", __VA_ARGS__)
/**
* Delay until we try to reconnect.
*/
struct GNUNET_TIME_Relative reconnect_delay;
-
};
* @param error error code
*/
static void
-mq_error_handler (void *cls,
- enum GNUNET_MQ_Error error)
+mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
{
struct GNUNET_TRANSPORT_AddressHandle *h = cls;
reconnect (void *cls)
{
struct GNUNET_TRANSPORT_AddressHandle *h = cls;
- struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_handler_end ()
- };
+ struct GNUNET_MQ_MessageHandler handlers[] = {GNUNET_MQ_handler_end ()};
h->reconnect_task = NULL;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Connecting to transport service.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n");
GNUNET_assert (NULL == h->mq);
- h->mq = GNUNET_CLIENT_connect (h->cfg,
- "transport",
- handlers,
- &mq_error_handler,
- h);
+ h->mq =
+ GNUNET_CLIENT_connect (h->cfg, "transport", handlers, &mq_error_handler, h);
}
disconnect (h);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Scheduling task to reconnect to transport service in %s.\n",
- GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay,
- GNUNET_YES));
+ GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay, GNUNET_YES));
h->reconnect_task =
- GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
- &reconnect,
- h);
+ GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
}
h = GNUNET_new (struct GNUNET_TRANSPORT_AddressHandle);
h->cfg = cfg;
h->reconnect_delay = GNUNET_TIME_UNIT_ZERO;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Connecting to transport service\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service\n");
reconnect (h);
if (NULL == h->mq)
{
* @param handle handle to the service as returned from #GNUNET_TRANSPORT_address_connect()
*/
void
-GNUNET_TRANSPORT_address_disconnect (struct GNUNET_TRANSPORT_AddressHandle *handle)
+GNUNET_TRANSPORT_address_disconnect (
+ struct GNUNET_TRANSPORT_AddressHandle *handle)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Transport disconnect called!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n");
/* this disconnects all neighbours... */
disconnect (handle);
/* and now we stop trying to connect again... */
struct GNUNET_MQ_Envelope *env;
struct GNUNET_TRANSPORT_AddressToVerify *hdr;
- env = GNUNET_MQ_msg_extra (hdr,
- raw_size,
- GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY);
+ env =
+ GNUNET_MQ_msg_extra (hdr,
+ raw_size,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_CONSIDER_VERIFY);
hdr->peer = *pid;
- memcpy (&hdr[1],
- raw,
- raw_size);
- GNUNET_MQ_send (ch->mq,
- env);
+ memcpy (&hdr[1], raw, raw_size);
+ GNUNET_MQ_send (ch->mq, env);
}
-
/* end of transport_api2_address.c */
/**
* What preference is being expressed?
*/
- enum GNUNET_MQ_PreferenceKind pk;
+ enum GNUNET_MQ_PriorityPreferences pk;
/**
* How much bandwidth does the client expect?
/**
- * We would like to receive address suggestions for a peer. TRANSPORT will
- * respond with a call to the continuation immediately containing an address or
- * no address if none is available. TRANSPORT can suggest more addresses until we call
- * #GNUNET_TRANSPORT_application_suggest_cancel().
+ * An application would like TRANSPORT to connect to a peer.
*
* @param ch handle
* @param peer identity of the peer we need an address for
* @param pk what kind of application will the application require (can be
- * #GNUNET_MQ_PREFERENCE_NONE, we will still try to connect)
+ * #GNUNET_MQ_PRIO_BACKGROUND, we will still try to connect)
* @param bw desired bandwith, can be zero (we will still try to connect)
* @return suggest handle, NULL if a request is already pending
*/
GNUNET_TRANSPORT_application_suggest (
struct GNUNET_TRANSPORT_ApplicationHandle *ch,
const struct GNUNET_PeerIdentity *peer,
- enum GNUNET_MQ_PreferenceKind pk,
+ enum GNUNET_MQ_PriorityPreferences pk,
struct GNUNET_BANDWIDTH_Value32NBO bw)
{
struct GNUNET_TRANSPORT_ApplicationSuggestHandle *s;