31 #define LOG(kind, ...) GNUNET_log_from (kind, "ats-performance-api", \
182 struct GNUNET_CLIENT_TransmitHandle *
th;
263 bandwidth_zero.
value__ = htonl (0);
306 const char *plugin_address;
308 uint16_t plugin_address_length;
309 uint16_t plugin_name_length;
311 plugin_address_length = ntohs (
pi->address_length);
312 plugin_name_length = ntohs (
pi->plugin_name_length);
313 plugin_address = (
const char *) &
pi[1];
314 plugin_name = &plugin_address[plugin_address_length];
315 if ((plugin_address_length + plugin_name_length
338 const char *plugin_address;
341 uint16_t plugin_address_length;
347 plugin_address_length = ntohs (
pi->address_length);
348 addr_active = (
int) ntohl (
pi->address_active);
349 plugin_address = (
const char *) &
pi[1];
350 plugin_name = &plugin_address[plugin_address_length];
356 pi->address_local_info);
357 address.address = plugin_address;
358 address.address_length = plugin_address_length;
383 amount = ntohl (rr->
amount);
432 const char *plugin_address;
434 uint16_t plugin_address_length;
435 uint16_t plugin_name_length;
437 plugin_address_length = ntohs (
pi->address_length);
438 plugin_name_length = ntohs (
pi->plugin_name_length);
439 plugin_address = (
const char *) &
pi[1];
440 plugin_name = &plugin_address[plugin_address_length];
441 if ((plugin_address_length + plugin_name_length
466 const char *plugin_address;
472 uint16_t plugin_address_length;
473 uint16_t plugin_name_length;
478 active = ntohl (
pi->address_active);
479 plugin_address_length = ntohs (
pi->address_length);
480 plugin_name_length = ntohs (
pi->plugin_name_length);
481 plugin_address = (
const char *) &
pi[1];
482 plugin_name = &plugin_address[plugin_address_length];
484 "Received ATS_ADDRESSLIST_RESPONSE message for peer %s and plugin %s\n",
489 while (NULL != (
alh = next))
498 memset (&allzeros,
'\0',
sizeof(allzeros));
500 (0 == plugin_name_length) &&
501 (0 == plugin_address_length))
505 "Received last message for ATS_ADDRESSLIST_RESPONSE\n");
506 bandwidth_zero.
value__ = htonl (0);
522 address.address = plugin_address;
523 address.address_length = plugin_address_length;
753 m->all = htonl (
all);
812 (void) va_arg (ap,
double);
817 (void) va_arg (ap,
double);
828 m->num_preferences = htonl (count);
837 pi[count].preference_kind = htonl (kind);
841 pi[count].preference_value = (float) va_arg (ap,
double);
847 pi[count].preference_value = (float) va_arg (ap,
double);
887 va_start (ap,
scope);
895 (void) va_arg (ap,
double);
900 (void) va_arg (ap,
double);
912 m->num_feedback = htonl (count);
916 va_start (ap,
scope);
921 pi[count].preference_kind = htonl (kind);
925 pi[count].preference_value = (float) va_arg (ap,
double);
931 pi[count].preference_value = (float) va_arg (ap,
double);
struct GNUNET_MQ_Envelope * env
automatic transport selection messages
@ START_FLAG_PERFORMANCE_NO_PIC
Performance monitoring client that does NOT want to learn about changes in performance characteristic...
@ START_FLAG_PERFORMANCE_WITH_PIC
Performance monitoring client that wants to learn about changes in performance characteristics.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
static char * init
Set to the name of a service to start.
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
static struct GNUNET_ATS_AddressListHandle * alh
ATS address list handle used.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static char * address
GNS address for this phone.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
static struct GNUNET_PEERINFO_Handle * pi
Handle to peerinfo service.
static void addr_info_cb(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Signature of a function that is called with QoS information about an address.
static char * plugin_name
Name of our plugin.
Automatic transport selection and outbound bandwidth determination.
struct GNUNET_ATS_PerformanceHandle * GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls)
Get handle to access performance API of the ATS subsystem.
void GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle *alh)
Cancel a pending address listing operation.
void GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph)
Client is done using the ATS performance subsystem, release resources.
void GNUNET_ATS_properties_ntoh(struct GNUNET_ATS_Properties *hbo, const struct GNUNET_ATS_PropertiesNBO *nbo)
Convert ATS properties from network to host byte order.
void GNUNET_ATS_performance_give_feedback(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TIME_Relative scope,...)
Send feedback to ATS on how good a the requirements for a peer and a preference is satisfied by ATS.
void GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc)
Cancel request for reserving bandwidth.
void GNUNET_ATS_performance_change_preference(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer,...)
Change preferences for the given peer.
const char * GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type)
Convert an enum GNUNET_ATS_PreferenceType to a string.
struct GNUNET_ATS_ReservationContext * GNUNET_ATS_reserve_bandwidth(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, int32_t amount, GNUNET_ATS_ReservationCallback rcb, void *rcb_cls)
Reserve inbound bandwidth from the given peer.
struct GNUNET_ATS_AddressListHandle * GNUNET_ATS_performance_list_addresses(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, int all, GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls)
Get information about addresses known to the ATS subsystem.
void(* GNUNET_ATS_AddressInformationCallback)(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Signature of a function that is called with QoS information about an address.
void(* GNUNET_ATS_ReservationCallback)(void *cls, const struct GNUNET_PeerIdentity *peer, int32_t amount, struct GNUNET_TIME_Relative res_delay)
Function called with reservation result.
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
#define GNUNET_ATS_PreferenceTypeString
ATS preference types as string array initializer.
@ GNUNET_ATS_PREFERENCE_BANDWIDTH
Change the peer's bandwidth value (value per byte of bandwidth in the goal function) to the given amo...
@ GNUNET_ATS_PREFERENCE_LATENCY
Change the peer's latency value to the given amount.
@ GNUNET_ATS_PREFERENCE_END
End of preference list.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
GNUNET_HELLO_AddressInfo
Additional local information about an address.
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.
#define GNUNET_VA_ARG_ENUM(va, X)
wrap va_arg for enums
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK
Type of the 'struct ChangePreferenceMessage' sent by clients to ATS to ask for allocation preference ...
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
Type of the 'struct AddressListRequestMessage' sent by client to ATS to request information about add...
#define GNUNET_MESSAGE_TYPE_ATS_START
Type of the 'struct ClientStartMessage' sent by clients to ATS to identify the type of the client.
#define GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT
Type of the 'struct ReservationResultMessage' sent by ATS to clients in response to a reservation req...
#define GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION
Type of the 'struct PeerInformationMessage' sent by ATS to clients to inform about QoS for a particul...
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE
Type of the 'struct AddressListResponseMessage' sent by ATS to client with information about addresse...
#define GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST
Type of the 'struct ReservationRequestMessage' sent by clients to ATS to ask for inbound bandwidth re...
#define GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE
Type of the 'struct ChangePreferenceMessage' sent by clients to ATS to ask for allocation preference ...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TIME_Relative GNUNET_TIME_relative_ntoh(struct GNUNET_TIME_RelativeNBO a)
Convert relative time from network byte order.
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
static enum GNUNET_NetworkType scope
Which network scope do we belong to?
Client to service: please give us an overview of the addresses.
int32_t all
GNUNET_YES to get information about all addresses, GNUNET_NO to only return addresses that are in use...
Client to ATS: I have a performance preference for a peer.
First message any client sends to ATS, used to self-identify (what type of client this is).
Message containing application feedback for a peer.
Linked list of pending reservations.
GNUNET_ATS_AddressInformationCallback cb
Callback.
struct GNUNET_ATS_AddressListHandle * prev
Kept in a DLL.
void * cb_cls
Callback closure for cb.
struct GNUNET_ATS_AddressListHandle * next
Kept in a DLL.
uint32_t id
Request multiplexing.
struct GNUNET_PeerIdentity peer
Target peer.
struct GNUNET_ATS_PerformanceHandle * ph
Performance handle.
int all_peers
Return all or specific peer only.
int all_addresses
Return all or used address only.
ATS performance characteristics for an address.
Linked list of pending reservations.
struct GNUNET_PeerIdentity peer
Target peer.
int undo
Do we need to undo this reservation if it succeeded? Set to GNUNET_YES if a reservation is cancelled.
struct GNUNET_ATS_ReservationContext * prev
Kept in a DLL.
struct GNUNET_ATS_ReservationContext * next
Kept in a DLL.
GNUNET_ATS_ReservationCallback rcb
Function to call on result.
void * rcb_cls
Closure for rcb.
int32_t size
Desired reservation.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
uint32_t value__
The actual value (bytes per second).
An address for communicating with a peer.
Handle to a message queue.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_TIME_RelativeNBO res_delay
struct GNUNET_PeerIdentity peer
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.