--- /dev/null
+// -----------------------------------------------------------------------
+// Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+//
+// Universidad de Cantabria, SPAIN
+// University of York, UK
+// Scuola Superiore Sant'Anna, ITALY
+// Kaiserslautern University, GERMANY
+// Univ. Politécnica Valencia, SPAIN
+// Czech Technical University in Prague, CZECH REPUBLIC
+// ENEA SWEDEN
+// Thales Communication S.A. FRANCE
+// Visual Tools S.A. SPAIN
+// Rapita Systems Ltd UK
+// Evidence ITALY
+//
+// See http://www.frescor.org for a link to partners' websites
+//
+// FRESCOR project (FP6/2005/IST/5-034026) is funded
+// in part by the European Union Sixth Framework Programme
+// The European Union is not liable of any use that may be
+// made of this code.
+//
+//
+// based on previous work (FSF) done in the FIRST project
+//
+// Copyright (C) 2005 Mälardalen University, SWEDEN
+// Scuola Superiore S.Anna, ITALY
+// Universidad de Cantabria, SPAIN
+// University of York, UK
+//
+// FSF API web pages: http://marte.unican.es/fsf/docs
+// http://shark.sssup.it/contrib/first/docs/
+//
+// This file is part of FRSH (FRescor ScHeduler)
+//
+// FRSH is free software; you can redistribute it and/or modify it
+// under terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option) any
+// later version. FRSH is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details. You should have received a
+// copy of the GNU General Public License along with FRSH; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FRSH header files in a file,
+// instantiating FRSH generics or templates, or linking other files
+// with FRSH objects to produce an executable application, does not
+// by itself cause the resulting executable application to be covered
+// by the GNU General Public License. This exception does not
+// however invalidate any other reasons why the executable file might be
+// covered by the GNU Public License.
+// -----------------------------------------------------------------------
+//==============================================
+// ******** ******* ******** ** **
+// **///// /**////** **////// /** /**
+// ** /** /** /** /** /**
+// ******* /******* /********* /**********
+// **//// /**///** ////////** /**//////**
+// ** /** //** /** /** /**
+// ** /** //** ******** /** /**
+// // // // //////// // //
+//
+// FRSH(FRescor ScHeduler), pronounced "fresh"
+//==============================================
+//
+// 18-Oct-2007 SANGORRIN: added frsh_marshal
+//
+
+//#include "frsh.h"
+//#include "frsh_internal.h"
+
+#if FRSH_DISTRIBUTED_MODULE_SUPPORTED
+
+#include "fosa.h"
+#include "fna_configuration.h" // for fna_operations, FNA_MAX_NETWORKS
+#include "frsh_debug_and_trace.h" // for FRSH_TRACE
+//#include "fadt_freelist.h" // for the list of endpoints
+#include <string.h>
+
+// TODO: add a mutex for concurrent access if necessary
+static frsh_endpoint_data_t endpoint_data[FRSH_MAX_N_ENDPOINTS];
+frsh_resource_id_t THE_FRSH_CPU_ID;
+
+static inline endpoint_alloc()
+{
+ return frsh_malloc(FRSH_ENDPOINT_SIZE);
+}
+
+static inline endpoint_free(frsh_endpoint_t endpoint)
+{
+ return frsh_free(endpoint);
+}
+
+//-------------------------//
+// check_valid_resource_id //
+//-------------------------//
+// Internal function to check that a given resource_id is valid
+
+static inline int check_valid_resource_id (const frsh_resource_id_t resource_id)
+{
+ if (resource_id >= FNA_MAX_NETWORKS || resource_id < 0) {
+ FRSH_ERR_RET(FRSH_ERR_RESOURCE_ID_INVALID);
+ }
+
+ if (fna_operations[resource_id] == NULL) {
+ FRSH_ERR_RET(FRSH_ERR_RESOURCE_ID_INVALID);
+ }
+
+ return 0;
+}
+
+//---------------------------//
+// check_valid_send_endpoint //
+//---------------------------//
+// Internal function to check that a given send_endpoint is valid. if it is
+// valid it returns the position, if not it returns -1
+
+static inline int check_valid_send_endpoint(frsh_send_endpoint_t endpoint)
+{
+ fna_endpoint_data_t* epoint = endpoint;
+
+ if ((!epoint) || (endpoint->endpoint_type != FRSH_SEND_ENDPOINT_TYPE)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+//------------------------------//
+// check_valid_receive_endpoint //
+//------------------------------//
+// Internal function to check that a given receive_endpoint is valid. if it is
+// valid it returns the position, if not it returns -1
+
+static inline int check_valid_receive_endpoint(frsh_receive_endpoint_t endpoint)
+{
+ fna_endpoint_data_t* epoint = endpoint;
+
+ if ((!epoint) || (endpoint->endpoint_type != FRSH_RECEIVE_ENDPOINT_TYPE)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+//-----------------------//
+// frsh_distributed_init //
+//-----------------------//
+// TODO: use a flag to say if it is initialized or not
+
+int frsh_distributed_init(void)
+{
+ frsh_resource_id_t id = 0;
+ int err = 0;
+
+ // execute the fna_init operation of each installed network
+ for (id=0; id<FNA_MAX_NETWORKS; id++) {
+ if (fna_operations[id] != NULL) {
+ //FRSH_TRACE(FRSH_TRACE_DISTRIBUTED, "init network id=%d\n", id);
+ err = fna_operations[id]->fna_init(id);
+ if (err != 0) return -1;
+ }
+ }
+
+ // initialize the freelist to handle the set of endpoints
+ //FRSH_TRACE(FRSH_TRACE_DISTRIBUTED, "init endpoints freelist\n");
+
+ return 0;
+}
+
+//-----------------------------------//
+// frsh_network_get_max_message_size //
+//-----------------------------------//
+
+int frsh_network_get_max_message_size
+ (const frsh_resource_id_t resource_id,
+ const frsh_network_address_t destination,
+ size_t *max_size)
+{
+ if (check_valid_resource_id(resource_id)) {
+ FRSH_ERR_RET(FRSH_ERR_RESOURCE_ID_INVALID);
+ }
+
+ if (fna_operations[resource_id]->fna_network_get_max_message_size == NULL) {
+ FRSH_ERR_RET(FRSH_ERR_INTERNAL_ERROR);
+ }
+
+ return fna_operations[resource_id]->fna_network_get_max_message_size
+ (resource_id, destination, max_size);
+}
+
+//------------------------------//
+// frsh_network_bytes_to_budget //
+//------------------------------//
+
+int frsh_network_bytes_to_budget
+ (const frsh_resource_id_t resource_id,
+ const size_t nbytes,
+ frsh_rel_time_t *budget)
+{
+ if (check_valid_resource_id(resource_id)) {
+ return FRSH_ERR_RESOURCE_ID_INVALID;
+ }
+
+ if (fna_operations[resource_id]->fna_network_bytes_to_budget == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->fna_network_bytes_to_budget
+ (resource_id, nbytes, budget);
+}
+
+//------------------------------//
+// frsh_network_budget_to_bytes //
+//------------------------------//
+
+int frsh_network_budget_to_bytes
+ (const frsh_resource_id_t resource_id,
+ const frsh_rel_time_t *budget,
+ size_t *nbytes)
+{
+ if (check_valid_resource_id(resource_id)) {
+ return FRSH_ERR_RESOURCE_ID_INVALID;
+ }
+
+ if (fna_operations[resource_id]->fna_network_budget_to_bytes == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->fna_network_budget_to_bytes
+ (resource_id, budget, nbytes);
+}
+
+//---------------------------------------//
+// frsh_network_get_min_effective_budget //
+//---------------------------------------//
+
+int frsh_network_get_min_effective_budget
+ (const frsh_resource_id_t resource_id,
+ frsh_rel_time_t *budget)
+{
+ if (check_valid_resource_id(resource_id)) {
+ return FRSH_ERR_RESOURCE_ID_INVALID;
+ }
+
+ if (fna_operations[resource_id]->fna_network_get_min_eff_budget == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->fna_network_get_min_eff_budget
+ (resource_id, budget);
+}
+
+//---------------------------//
+// frsh_send_endpoint_create //
+//---------------------------//
+
+int frsh_send_endpoint_create
+ (frsh_resource_id_t resource_id,
+ frsh_network_address_t destination,
+ frsh_stream_id_t stream_id,
+ frsh_send_endpoint_protocol_info_t protocol_info,
+ frsh_send_endpoint_t *endpoint)
+{
+ frsh_endpoint_t epoint;
+
+ if (check_valid_resource_id(resource_id)) {
+ return FRSH_ERR_RESOURCE_ID_INVALID;
+ }
+
+ if (endpoint == NULL) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ // allocate a free endpoint position in the table
+ epoint = endpoint_alloc();
+
+ if (epoint == NULL) {
+ return FRSH_ERR_NO_SPACE;
+ }
+
+ // initialize the send endpoint
+ epoint->endpoint_type = FRSH_SEND_ENDPOINT_TYPE;
+ epoint->resource_id = resource_id;
+ epoint->destination = destination;
+ epoint->stream_id = stream_id;
+ epoint->endpoint_protocol_info.send = protocol_info;
+ epoint->vres = 666; // the number of the beast!
+ epoint->is_bound = false;
+ FRSH_TRACE(FRSH_TRACE_DISTRIBUTED,"%s:stream_id=%d\n", __func__, stream_id);
+
+ // the send_endpoint identifier for the user is the position in the table
+ *endpoint = epoint;
+ return 0;
+}
+
+// int frsh_contract_set_queueing_info(frsh_endpoint_queueing_info_t queueing_info,
+// frsh_contract_t *contract);
+//
+// int frsh_contract_get_queueing_info(const frsh_contract_t *contract,
+// frsh_endpoint_queueing_info_t *queueing_info);
+//
+// int frsh_contract_set_protocol_info(frsh_protocol_info_t protocol_info,
+// frsh_contract_t *contract);
+//
+// int frsh_contract_get_protocol_info(frsh_contract_t *contract,
+// frsh_protocol_info_t *protocol_info);
+//
+
+
+//-------------------------------//
+// frsh_send_endpoint_get_params //
+//-------------------------------//
+
+int frsh_send_endpoint_get_params
+ (const frsh_send_endpoint_t endpoint,
+ frsh_resource_id_t *resource_id,
+ frsh_network_address_t *destination,
+ frsh_stream_id_t *stream,
+ frsh_send_endpoint_protocol_info_t *protocol_info)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ *resource_id = endpoint->resource_id;
+ *destination = endpoint->destination;
+ *stream = endpoint->stream_id;
+ *protocol_info = endpoint_data->endpoint_protocol_info.send;
+
+ return 0;
+}
+
+//----------------------------//
+// frsh_send_endpoint_destroy //
+//----------------------------//
+
+int frsh_send_endpoint_destroy
+ (frsh_send_endpoint_t endpoint)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ endpoint_free(endpoint);
+
+ return 0;
+}
+
+//-------------------------//
+// frsh_send_endpoint_bind //
+//-------------------------//
+
+int frsh_send_endpoint_bind
+ (frsh_vres_id_t vres,
+ frsh_send_endpoint_t endpoint)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ // TODO: check that resource_id and resource_type matches
+ endpoint->vres = vres;
+ endpoint->is_bound = true;
+ /*FRSH_TRACE(FRSH_TRACE_DISTRIBUTED,"%s:vres=%d\n", __func__,
+ endpoint_data[pos].vres);*/
+
+ return 0;
+}
+
+//---------------------------//
+// frsh_send_endpoint_unbind //
+//---------------------------//
+
+int frsh_send_endpoint_unbind
+ (frsh_send_endpoint_t endpoint)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ endpoint->vres = 666; // the number of the beast!
+ endpoint->is_bound = false;
+
+ return 0;
+}
+
+//--------------------------------//
+// frsh_send_endpoint_get_vres_id //
+//--------------------------------//
+
+int frsh_send_endpoint_get_vres_id
+ (const frsh_send_endpoint_t endpoint,
+ frsh_vres_id_t *vres)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ *vres = endpoint->vres;
+ return 0;
+}
+
+//-----------------//
+// frsh_send_async //
+//-----------------//
+
+int frsh_send_async
+ (const frsh_send_endpoint_t endpoint,
+ const void *msg,
+ const size_t size)
+{
+ frsh_resource_id_t resource_id;
+
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ if (endpoint->is_bound == false) {
+ return FRSH_ERR_NOT_BOUND;
+ }
+
+ resource_id = endpoint->resource_id;
+
+ if (fna_operations[resource_id]->fna_send_async == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->fna_send_async
+ (endpoint, msg, size);
+}
+
+//-----------------//
+// frsh_send_sync //
+//-----------------//
+
+int frsh_send_sync
+ (const frsh_send_endpoint_t endpoint,
+ const void *msg,
+ const size_t size)
+{
+ frsh_resource_id_t resource_id;
+
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ if (endpoint->is_bound == false) {
+ return FRSH_ERR_NOT_BOUND;
+ }
+
+ resource_id = endpoint->resource_id;
+
+ if (fna_operations[resource_id]->fna_send_sync == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->fna_send_sync
+ (endpoint, msg, size);
+}
+
+// int frsh_send_endpoint_get_status(const frsh_send_endpoint_t endpoint,
+// int *number_pending_msg,
+// frsh_endpoint_network_status_t *network_status,
+// frsh_protocol_status_t *protocol_status);
+//
+
+//------------------------------//
+// frsh_receive_endpoint_create //
+//------------------------------//
+
+int frsh_receive_endpoint_create
+ (frsh_resource_id_t resource_id,
+ frsh_stream_id_t stream_id,
+ frsh_endpoint_queueing_info_t queueing_info,
+ frsh_receive_endpoint_protocol_info_t protocol_info,
+ frsh_receive_endpoint_t *endpoint)
+{
+ frsh_endpoint_t epoint;
+
+ if (check_valid_resource_id(resource_id)) {
+ return FRSH_ERR_RESOURCE_ID_INVALID;
+ }
+
+ if (endpoint == NULL) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ if (epoint = endpoint_alloc() == NULL) {
+ return FRSH_ERR_NO_SPACE;
+ }
+
+ // initialize the receive_endpoint
+ epoint->endpoint_type = FRSH_RECEIVE_ENDPOINT_TYPE;
+ epoint->resource_id = resource_id;
+ epoint->stream_id = stream_id;
+ epoint->queue_info = queueing_info;
+ epoint->endpoint_protocol_info.receive = protocol_info;
+
+ //FRSH_TRACE(FRSH_TRACE_DISTRIBUTED,"%s:stream_id=%d\n", __func__, stream_id);
+ // the receive_endpoint identifier for the user is the position in the table
+ *endpoint = pos;
+
+ if (fna_operations[resource_id]->fna_receive_endpoint_created == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->
+ fna_receive_endpoint_created(endpoint);
+}
+
+//----------------------------------//
+// frsh_receive_endpoint_get_params //
+//----------------------------------//
+
+int frsh_receive_endpoint_get_params
+ (const frsh_receive_endpoint_t endpoint,
+ frsh_resource_id_t *resource_id,
+ frsh_stream_id_t *stream,
+ frsh_endpoint_queueing_info_t *queueing_info,
+ frsh_receive_endpoint_protocol_info_t *protocol_info)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ *resource_id = endpoint->resource_id;
+ *stream = endpoint->stream_id;
+ *queueing_info = endpoint->queue_info;
+ *protocol_info = endpoint->endpoint_protocol_info.receive;
+
+ return 0;
+}
+
+//-------------------------------//
+// frsh_receive_endpoint_destroy //
+//-------------------------------//
+
+int frsh_receive_endpoint_destroy
+ (frsh_receive_endpoint_t endpoint)
+{
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ endpoint_free(endpoint);
+ return 0;
+}
+
+//-------------------//
+// frsh_receive_sync //
+//-------------------//
+
+int frsh_receive_sync
+ (const frsh_receive_endpoint_t endpoint,
+ void *buffer,
+ size_t buffer_size,
+ size_t *message_size,
+ frsh_network_address_t *from)
+{
+ frsh_resource_id_t resource_id;
+
+ if (check_valid_send_endpoint(endpoint) < 0) {
+ return FRSH_ERR_BAD_ARGUMENT;
+ }
+
+ resource_id = endpoint->resource_id;
+
+ if (fna_operations[resource_id]->fna_receive_sync == NULL) {
+ return FRSH_ERR_INTERNAL_ERROR;
+ }
+
+ return fna_operations[resource_id]->fna_receive_sync
+ (endpoint, buffer, buffer_size, message_size, from);
+}
+
+//
+// int frsh_receive_async
+// (const frsh_receive_endpoint_t endpoint,
+// void *buffer,
+// size_t buffer_size,
+// size_t *message_size,
+// frsh_network_address_t *from);
+//
+// int frsh_receive_endpoint_get_status(const frsh_receive_endpoint_t endpoint,
+// int *number_pending_messages,
+// frsh_endpoint_network_status_t *network_status,
+// frsh_protocol_status_t *protocol_status);
+
+#endif /* FRSH_DISTRIBUTED_MODULE_SUPPORTED */
--- /dev/null
+// -----------------------------------------------------------------------
+// Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+//
+// Universidad de Cantabria, SPAIN
+// University of York, UK
+// Scuola Superiore Sant'Anna, ITALY
+// Kaiserslautern University, GERMANY
+// Univ. Politécnica Valencia, SPAIN
+// Czech Technical University in Prague, CZECH REPUBLIC
+// ENEA SWEDEN
+// Thales Communication S.A. FRANCE
+// Visual Tools S.A. SPAIN
+// Rapita Systems Ltd UK
+// Evidence ITALY
+//
+// See http://www.frescor.org for a link to partners' websites
+//
+// FRESCOR project (FP6/2005/IST/5-034026) is funded
+// in part by the European Union Sixth Framework Programme
+// The European Union is not liable of any use that may be
+// made of this code.
+//
+//
+// based on previous work (FSF) done in the FIRST project
+//
+// Copyright (C) 2005 Mälardalen University, SWEDEN
+// Scuola Superiore S.Anna, ITALY
+// Universidad de Cantabria, SPAIN
+// University of York, UK
+//
+// FSF API web pages: http://marte.unican.es/fsf/docs
+// http://shark.sssup.it/contrib/first/docs/
+//
+// This file is part of FRSH (FRescor ScHeduler)
+//
+// FRSH is free software; you can redistribute it and/or modify it
+// under terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option) any
+// later version. FRSH is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details. You should have received a
+// copy of the GNU General Public License along with FRSH; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FRSH header files in a file,
+// instantiating FRSH generics or templates, or linking other files
+// with FRSH objects to produce an executable application, does not
+// by itself cause the resulting executable application to be covered
+// by the GNU General Public License. This exception does not
+// however invalidate any other reasons why the executable file might be
+// covered by the GNU Public License.
+// -----------------------------------------------------------------------
+//frsh_distributed.h
+//==============================================
+// ******** ******* ******** ** **
+// **///// /**////** **////// /** /**
+// ** /** /** /** /** /**
+// ******* /******* /********* /**********
+// **//// /**///** ////////** /**//////**
+// ** /** //** /** /** /**
+// ** /** //** ******** /** /**
+// // // // //////// // //
+//
+// FRSH(FRescor ScHeduler), pronounced "fresh"
+//==============================================
+#ifndef _FRSH_DISTRIBUTED_H_
+#define _FRSH_DISTRIBUTED_H_
+
+
+/**
+ * @file frsh_distributed.h
+ **/
+
+
+#include "frsh_distributed_types.h"
+#include "frsh_core_types.h"
+
+FRSH_CPP_BEGIN_DECLS
+
+// this global variable is assigned by frsh_distributed_init()
+extern frsh_resource_id_t THE_FRSH_CPU_ID;
+
+/**
+ * @defgroup distributed Distributed module
+ *
+ * This module defines the functions and typedefs for use in
+ * distributed applications.
+ *
+ * Each network is identified by its resource_id and FRSH hides its
+ * characteristics completely. The type of network is implied with
+ * its ID via a configuration table defined at compile time.
+ *
+ * FRSH uses the "message" as the atomic unit for every exchange.
+ * Queue sizes are measured in number of pending messages.
+ *
+ * FRSH provides a function to calculate the transmision time needed
+ * for a certain message size in a network as well as the maximum
+ * message size that can admit.
+ *
+ * Note also that package delivery guarantee is protocol dependent.
+ * For protocols in which the order is no guaranteed, the application
+ * needs to add extra info to detect possible package disorder.
+ *
+ * Summary of typical steps.
+ *
+ * 1. Map (internally in FRSH implementation)
+ * - node--> network_addresses
+ * - network --> resource_id's
+ * - unidirectional communication channel --> stream_id
+ * - other config --> protocol_info.
+ *
+ * 2. In a sending node:
+ * 2.1. Negotiates a "network contract" per communication channel
+ * that is used in the application. In the contract it is
+ * specified:
+ * - frsh_resource_type = FRSH_RT_NETWORK.
+ * - frsh_resource_id = <network id #>
+ * - budget: Time needed to send the required data per period.
+ * (you can use frsh_netinfo_*() functions for this).
+ * - period: Period of sendings.
+ * - Queueing info: How will sends be queued at sendEndpoint.
+ * - Other protocol dependent function in protocol_contract_info.
+ * 2.2. Create a send_endpoint per any unidirectional stream that will
+ * be used in sending
+ * resource_id --> the network through which the stream will
+ * flow (this is extra info needed for coherency
+ * with the bind).
+ * destinator --> network_address of the destination.
+ * stream_id --> the unidirectional communication channel.
+ * 2.3. Bind the send_endpoint to the network contract negotiated
+ * above.
+ * 2.4. The (processor) sending vres invokes frsh_send_(a)sync() to
+ * send the data through the corresponding stream.
+ *
+ * 3. In a receiving node:
+ * 3.1. Create a receive_endpoint per any unidirectional stream
+ * that will be used in receiving.
+ * 3.2. The processor expecting a reception of message invokes
+ * frsh_receive_(a)sync() to read the incoming data.
+ *
+ * 4. When all comunication is finished and the channel is no longer
+ * needed the nodes will destroy the send and receive endpoints
+ * and the network contract will be canceled.
+ **/
+
+/**
+ * frsh_distributed_init(void)
+ *
+ * This operation initializes all the installed networks and the structures
+ * that are necessary for the distributed module. Currently it is called by
+ * frsh_init so it is not necessary that the user calls it again.
+ *
+ * 0: No error \n
+ * FRSH_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *
+ **/
+int frsh_distributed_init(void);
+
+//////////////////////////////////////////////////////////////////////
+// CONTRACT ASPECTS
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * @defgroup distcontract Contract Info for Distributed Systems
+ * @ingroup distributed
+ *
+ * These functions help you calculate the needed budget for network
+ * contracts and also to include protocol dependent info in contract
+ * parameters.
+ *
+ * @{
+ **/
+
+/**
+ * frsh_network_get_max_message_size()
+ *
+ * This operation gives the maximum number of bytes that can be sent
+ * at a time through the send function when using the network designated by
+ * 'resource_id' and sending it to 'destination'.
+ *
+ * If the application needs to send bigger messages it will have to
+ * split them.
+ *
+ * Some protocols, like IP, are capable of sending large messages
+ * (and use fragmentation internally) but other protocols don't.
+ *
+ * @param[in] resource_id The network we want the tx time from.
+ * @param[in] destination The destination address
+ * @param[out] max_size The maximum number of bytes for each message
+ *
+ * @return
+ * FRSH_NO_ERROR \n
+ * FRSH_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ * FRSH_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ * FRSH_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ * a network accessible from the current processing node \n
+ * FRSH_ERR_BAD_ARGUMENT: if pointers are NULL or destination is
+ * invalid \n
+ *
+ **/
+int frsh_network_get_max_message_size
+ (const frsh_resource_id_t resource_id,
+ const frsh_network_address_t destination,
+ size_t *max_size);
+
+/**
+ * frsh_network_bytes_to_budget()
+ *
+ * This operation converts a number of bytes into a temporal budget for
+ * a specific network. Network overheads are not included here but are
+ * considered internally when negotiating a specific contract.
+ *
+ * @param[in] resource_id The network
+ * @param[in] nbytes Number of bytes
+ * @param[out] budget The network budget for nbytes
+ *
+ * @return
+ * FRSH_NO_ERROR \n
+ * FRSH_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ * FRSH_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ * FRSH_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ * a network accessible from the current processing node \n
+ * FRSH_ERR_BAD_ARGUMENT: if pointers are NULL or nbytes is less
+ * than zero \n
+ *
+ **/
+int frsh_network_bytes_to_budget
+ (const frsh_resource_id_t resource_id,
+ const size_t nbytes,
+ frsh_rel_time_t *budget);
+
+/**
+ * frsh_network_budget_to_bytes()
+ *
+ * This operation converts a temporal budget into a number of bytes for
+ * a specific network. Network overheads are not included.
+ *
+ * @param[in] resource_id The network
+ * @param[in] budget The network budget for nbytes
+ * @param[out] nbytes Number of bytes
+ *
+ * @return
+ * FRSH_NO_ERROR \n
+ * FRSH_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ * FRSH_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ * FRSH_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ * a network accessible from the current processing node \n
+ * FRSH_ERR_BAD_ARGUMENT: if pointers are NULL or budget refers to
+ * an invalid time value \n
+ *
+ **/
+int frsh_network_budget_to_bytes
+ (const frsh_resource_id_t resource_id,
+ const frsh_rel_time_t *budget,
+ size_t *nbytes);
+
+/**
+ * frsh_network_get_min_effective_budget()
+ *
+ * This operation gets the minimum effective budget for a network. Each message
+ * consumes a contracted budget in "chunks" (i.e: packets) that we call
+ * minimum effective budget.
+ *
+ * A negotiated contract, for N bytes in a period T, means that there is a
+ * virtual resource that reserves for the user:
+ *
+ * Ceiling ((N bytes) / budget_to_bytes (min_effective_budget)) "CHUNKS"
+ *
+ * Note that if the user decides not to send these N bytes at once but, say,
+ * one byte at a time, it will consume one "CHUNK" at a time and the reserved
+ * budget will become exhausted before sending all the bytes.
+ *
+ * @param[in] resource_id The network
+ * @param[out] budget The network budget
+ *
+ * @return
+ * FRSH_NO_ERROR \n
+ * FRSH_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ * FRSH_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ * FRSH_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ * a network accessible from the current processing node \n
+ * FRSH_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frsh_network_get_min_effective_budget
+ (const frsh_resource_id_t resource_id,
+ frsh_rel_time_t *budget);
+
+/**
+ * frsh_contract_set_queueing_info()
+ *
+ * This function adds queueing parameters that will be used in the
+ * sendEndpoint when the sendEndpoint is bound to the vres.
+ **/
+int frsh_contract_set_queueing_info(frsh_endpoint_queueing_info_t queueing_info,
+ frsh_contract_t *contract);
+
+/**
+ * frsh_contract_get_queueing_info()
+ *
+ * This function gets the queueing parameters that were specified in
+ * the network contract.
+ **/
+int frsh_contract_get_queueing_info(const frsh_contract_t *contract,
+ frsh_endpoint_queueing_info_t *queueing_info);
+
+/**
+ * frsh_contract_set_protocol_info
+ *
+ * We add protocol info to the contract
+ **/
+int frsh_contract_set_protocol_info(frsh_protocol_info_t protocol_info,
+ frsh_contract_t *contract);
+
+/**
+ * frsh_contract_get_protocol_info
+ *
+ * We get protocol info from the contract
+ **/
+int frsh_contract_get_protocol_info(frsh_contract_t *contract,
+ frsh_protocol_info_t *protocol_info);
+
+/*@}*/
+//////////////////////////////////////////////////////////////////////
+// TWO STEP NEGOTIATION
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * @defgroup twostepnego Two Step Negotiation
+ * @ingroup distributed
+ *
+ * Using the core services of FRSH, contracts may be negotiated in a
+ * single step.
+ *
+ * An alternative two-step negotiation process is introduced in the
+ * distribution module: the first step involves the reservation of the
+ * resources, but without the right to use them, and the second step
+ * is the commitment to use those resources.
+ *
+ * The rationale behind this approach is that in distributed systems,
+ * when a distributed transaction is being negotiated the system
+ * should only commit the virtual resources that were negotiated with
+ * various nodes in the system if the results of all negotiations
+ * match together. This approach enhances the efficiency since the
+ * actual temporal values of the virtual resources on distributed
+ * nodes are only changed if the initiator of the distributed
+ * transaction is satisfied with the results of the negotiations.
+ *
+ * After the reservation, it is not necessary to change the actual
+ * virtual resource attributes (and modifying the schedule) on each
+ * node before the initiator of the distributed transaction knows the
+ * amount of available virtual resources. A renegotiation of a
+ * reserved virtual resource is possible, to harmonize for the
+ * available virtual resources in other parts of the system, before a
+ * final commitment is made.
+ *
+ * @{
+ **/
+
+
+/**
+ * frsh_contract_negotiate_reservation()
+ *
+ * Negotiate a service contract, obtaining a virtual resource id that
+ * represents a reservation of resources, but without the right to use
+ * those resources until the reservation is committed via
+ * frsh_vres_commit_reservation. In particular, this virtual resource
+ * cannot be bound until committed, but renegotiations are allowed for
+ * it.
+ */
+int frsh_contract_negotiate_reservation
+ (const frsh_contract_t *contract,
+ frsh_vres_id_t *vres);
+
+/**
+ * frsh_vres_commit_reservation()
+ *
+ * Commit the resources reserved for a virtual resource through a
+ * frsh_contract_negotiate_reservation operation. The effects of
+ * subsequent calls to frsh_contract_negotiate_reservation and
+ * frsh_vres_commit_reservation are equivalent to a single call to
+ * frsh_contract_negotiate.
+ */
+int frsh_vres_commit_reservation
+ (const frsh_vres_id_t vres);
+
+/* @} */
+
+
+
+//////////////////////////////////////////////////////////////////////
+// TRANSMISSION SERVICES
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * @defgroup txservices Transmission services
+ * @ingroup distributed
+ *
+ * These functions allow to create and manage endpoints for sending
+ * and receiving and to perform send and receive operations both
+ * synchronously (blocking) and asynchronously (non-blocking).
+ *
+ * @{
+ **/
+
+
+/**
+ * frsh_send_endpoint_create()
+ *
+ * This operation creates a unidirectional stream input endpoint
+ * through which, after the corresponding binding, it is possible to
+ * send data to a unicast or multicast destination.
+ *
+ * @param[in] resource_id Identifier of the network referred in the
+ * network contract as a resource_id.
+ * @param[in] destination FRSH abstraction of the protocol address for the
+ * destinator node.
+ * @param[in] stream_id Identifier of the communication channel between
+ * the nodes. Multiplexing is achieved by using
+ * different streams between the same nodes and the
+ * same network.
+ * @param[in] queueing_info Queueing params of the endpoint (size and
+ * policy).
+ * @param[in] protocol_info Optional protocol-dependent info.
+ * @param[out] endpoint Placeholder for the endpoint object.
+ **/
+int frsh_send_endpoint_create
+ (frsh_resource_id_t resource_id,
+ frsh_network_address_t destination,
+ frsh_stream_id_t stream_id,
+ frsh_send_endpoint_protocol_info_t protocol_info,
+ frsh_send_endpoint_t *endpoint);
+
+/**
+ * frsh_send_endpoint_get_params()
+ *
+ * This operation returns in the variables associated to the
+ * endpoint at creation time.
+ **/
+int frsh_send_endpoint_get_params
+ (const frsh_send_endpoint_t endpoint,
+ frsh_resource_id_t *resource_id,
+ frsh_network_address_t *destination,
+ frsh_stream_id_t *stream,
+ frsh_send_endpoint_protocol_info_t *protocol_info);
+
+/**
+ * frsh_send_endpoint_destroy()
+ *
+ * This operation eliminates any resources reserved for the referenced
+ * endpoint. Pending messages will be discarded and processor-vres
+ * waiting in a synchronous operation will be awoken with an error
+ * code.
+ **/
+int frsh_send_endpoint_destroy
+ (frsh_send_endpoint_t endpoint);
+
+/**
+ * frsh_send_endpoint_bind()
+ *
+ * This operation associates a send endpoint with a network vres,
+ * which means that messages sent through this endpoint will consume
+ * the vres's reserved bandwidth and its packets will be sent
+ * according to the contract established for that vres.
+ *
+ * If the endpoint is already bound to another vres, it is effectively
+ * unbound from it and bound to the specified one. However if a vres
+ * is already bound to another endpoint an error is returned.
+ *
+ * A consistency check is done in which the resource_id specified at
+ * endpoint creation must correspond to the resource_id of the vres
+ * contract.
+ *
+ * @return 0 if successful \n
+ * FRSH_ERR_BAD_ARGUMENT if the endpoint or the vres are not
+ * valid \n
+ * FRSH_ERR_ALREADY_BOUND if the vres is already bound to some
+ * other send endpoint \n
+ * FRSH_ERR_WRONG_NETWORK if the vres network id is not the same
+ * as the one in the endpoint \n
+ **/
+int frsh_send_endpoint_bind
+ (frsh_vres_id_t vres,
+ frsh_send_endpoint_t endpoint);
+
+/**
+ * frsh_send_endpoint_unbind()
+ *
+ * This operation unbinds a send endpoint from a vres. Endpoints with
+ * no vres associated cannot be used to send data, and they stay in
+ * that state until they are either eliminated or bound again.
+ *
+ * @return 0 if successful \n
+ * FRSH_ERR_NOT_BOUND if the endpoint was not bound \n
+ **/
+int frsh_send_endpoint_unbind
+ (frsh_send_endpoint_t endpoint);
+
+/**
+ * frsh_send_endpoint_get_vres_id()
+ *
+ * This operation copies the id of the vres that is bound to the
+ * specified send endpoint into the variable pointed to by vres.
+ *
+ * @return 0 if successful \n
+ * FRSH_ERR_NOT_BOUND if the endpoint was not bound \n
+ * FRSH_ERR_BAD_ARGUMENT if the endpoint is not valid or vres
+ * is NULL \n
+ **/
+int frsh_send_endpoint_get_vres_id
+ (const frsh_send_endpoint_t endpoint,
+ frsh_vres_id_t *vres);
+
+/**
+ * frsh_send_async()
+ *
+ * This operation sends a message stored in msg and of length size
+ * through the given endpoint. The operation is non-blocking and
+ * returns immediately.
+ *
+ * An internal frsh service will schedule the sending of messages and
+ * implement the communications sporadic vres corresponding to the
+ * network vres bound to the given endpoint.
+ *
+ * @returns 0 if successful \n
+ * FRSH_ERR_BAD_ARGUMENT if endpoint is not valid \n
+ * FRSH_ERR_NOT_BOUND if endpoint is not bound to a valid vres \n
+ * FRSH_ERR_TOO_LARGE if the message is too large for the
+ * network protocol \n
+ * FRSH_ERR_BUFFER_FULL if the message has been discarded
+ * because the queue is full (and does not
+ * have the policy FRSH_QP_OLDEST \n
+ **/
+int frsh_send_async
+ (const frsh_send_endpoint_t endpoint,
+ const void *msg,
+ const size_t size);
+
+/**
+ * frsh_send_sync()
+ *
+ * Similar to previous function but now the sending vres gets blocked
+ * until the message is processed.
+ **/
+int frsh_send_sync
+ (const frsh_send_endpoint_t endpoint,
+ const void *msg,
+ size_t size);
+
+/**
+ * frsh_send_endpoint_get_status()
+ *
+ * This function tells the number of messages still pending in the
+ * endpoint queue, whether the network is up or down with some
+ * optional information which is protocol_dependent.
+ **/
+int frsh_send_endpoint_get_status
+ (const frsh_send_endpoint_t endpoint,
+ int *number_pending_msg,
+ frsh_endpoint_network_status_t *network_status,
+ frsh_protocol_status_t *protocol_status);
+
+/**
+ * frsh_receive_endpoint_create()
+ *
+ * This operation creates a receive endpoint associated with a
+ * undirectional stream within a network interface of the node.
+ *
+ * Receiving endpoints are not bound to any network vres, this is
+ * because don't originate any traffic.
+ *
+ * Note that the protocol address is not needed for reception because
+ * it can be determined internally by FRSH based on the resource_id.
+ *
+ * Note also that messages may come from diferent originators.
+ *
+ * @param[in] resource_id Id of the network from which we listen.
+ * @param[in] stream_id Id of the stream within the network.
+ * @param[in] queueing_info Buffering information(queue size and
+ * policy).
+ * @param[in] protocol_info Extra protocol info opaque for the
+ * application.
+ * @param[in] endpoin Placeholder for the endpoint object.
+ *
+ * @return 0 if successful \n
+ * FRSH_ERR_BAD_ARGUMENT if the stream or the network id are not
+ * valid \n
+ **/
+int frsh_receive_endpoint_create
+ (frsh_resource_id_t resource_id,
+ frsh_stream_id_t stream_id,
+ frsh_endpoint_queueing_info_t queueing_info,
+ frsh_receive_endpoint_protocol_info_t protocol_info,
+ frsh_receive_endpoint_t *endpoint);
+
+/**
+ * frsh_receive_endpoint_get_params()
+ *
+ * This operation returns in the variables associated to the
+ * endpoint at creation time.
+ **/
+int frsh_receive_endpoint_get_params
+ (const frsh_receive_endpoint_t endpoint,
+ frsh_resource_id_t *resource_id,
+ frsh_stream_id_t *stream,
+ frsh_endpoint_queueing_info_t *queueing_info,
+ frsh_receive_endpoint_protocol_info_t *protocol_info);
+
+/**
+ * frsh_receive_endpoint_destroy()
+ *
+ * This operation eliminates any resources reserved for the referenced
+ * endpoint. Pending messages will be discarded and processor-vres
+ * waiting in a synchronous operation will be awoken with an error
+ * code.
+ **/
+int frsh_receive_endpoint_destroy
+ (frsh_receive_endpoint_t endpoint);
+
+
+/**
+ * frsh_receive_sync()
+ *
+ * If there are no messages available in the specified receive endpoint
+ * this operation blocks the calling thread waiting for a message to be
+ * received.
+ *
+ * When a message is available, if its size is less than or
+ * equal to the buffer_size, the function stores it in the variable
+ * pointed to by buffer and puts the number of bytes received in the
+ * variable pointed to by message size.
+ *
+ * The function fails with FRSH_ERR_NO_SPACE if the buffersize is
+ * too small for the message received. In this case the message is
+ * lost.
+ *
+ * Messages arriving at a destination buffer that is full will be
+ * silently discarded (details in the queueing policy of the
+ * endpoint). The application is responsible of reading the receive
+ * endpoints with appropriate regularity, or of using a sequence
+ * number or some other mechanism to detect any lost messages.
+ *
+ * @return 0 if successful \n
+ * FRSH_ERR_BAD_ARGUMENT if the endpoint is not valid, or if
+ * buffer or message_size are NULL.\n
+ * FRSH_ERR_NO_SPACE if the message size is bigger than the
+ * provided buffer \n
+ **/
+int frsh_receive_sync
+ (const frsh_receive_endpoint_t endpoint,
+ void *buffer,
+ size_t buffer_size,
+ size_t *message_size,
+ frsh_network_address_t *from);
+
+/**
+ * frsh_receive_async()
+ *
+ * This operation is similar to the previous one but it works in a non
+ * blocking (asynchronous) fashion. If no message is available it
+ * returns with error FRSH_NO_MESSAGE.
+ *
+ * @return 0 if successful \n
+ * FRSH_ERR_BAD_ARGUMENT if the endpoint is not valid, or if
+ * buffer or message_size are NULL \n
+ * FRSH_NO_MESSAGE if no messages are available in the queue \n
+ * FRSH_ERR_NO_SPACE if the message size is bigger than the
+ * provided buffer \n
+ **/
+int frsh_receive_async
+ (const frsh_receive_endpoint_t endpoint,
+ void *buffer,
+ size_t buffer_size,
+ size_t *message_size,
+ frsh_network_address_t *from);
+
+
+/**
+ * frsh_receive_endpoint_get_status
+ *
+ * This function tells the number of messages still pending in the
+ * endpoint queue, whether the network is up or down and some optional
+ * information which is protocol dependent.
+ **/
+int frsh_receive_endpoint_get_status
+ (const frsh_receive_endpoint_t endpoint,
+ int *number_pending_messages,
+ frsh_endpoint_network_status_t *network_status,
+ frsh_protocol_status_t *protocol_status);
+
+/*@}*/
+
+FRSH_CPP_END_DECLS
+
+#endif // _FRSH_DISTRIBUTED_H_
--- /dev/null
+// -----------------------------------------------------------------------
+// Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+//
+// Universidad de Cantabria, SPAIN
+// University of York, UK
+// Scuola Superiore Sant'Anna, ITALY
+// Kaiserslautern University, GERMANY
+// Univ. Politécnica Valencia, SPAIN
+// Czech Technical University in Prague, CZECH REPUBLIC
+// ENEA SWEDEN
+// Thales Communication S.A. FRANCE
+// Visual Tools S.A. SPAIN
+// Rapita Systems Ltd UK
+// Evidence ITALY
+//
+// See http://www.frescor.org for a link to partners' websites
+//
+// FRESCOR project (FP6/2005/IST/5-034026) is funded
+// in part by the European Union Sixth Framework Programme
+// The European Union is not liable of any use that may be
+// made of this code.
+//
+//
+// based on previous work (FSF) done in the FIRST project
+//
+// Copyright (C) 2005 Mälardalen University, SWEDEN
+// Scuola Superiore S.Anna, ITALY
+// Universidad de Cantabria, SPAIN
+// University of York, UK
+//
+// FSF API web pages: http://marte.unican.es/fsf/docs
+// http://shark.sssup.it/contrib/first/docs/
+//
+// This file is part of FRSH (FRescor ScHeduler)
+//
+// FRSH is free software; you can redistribute it and/or modify it
+// under terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option) any
+// later version. FRSH is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details. You should have received a
+// copy of the GNU General Public License along with FRSH; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FRSH header files in a file,
+// instantiating FRSH generics or templates, or linking other files
+// with FRSH objects to produce an executable application, does not
+// by itself cause the resulting executable application to be covered
+// by the GNU General Public License. This exception does not
+// however invalidate any other reasons why the executable file might be
+// covered by the GNU Public License.
+// -----------------------------------------------------------------------
+
+//==============================================
+// ******** ******* ******** ** **
+// **///// /**////** **////// /** /**
+// ** /** /** /** /** /**
+// ******* /******* /********* /**********
+// **//// /**///** ////////** /**//////**
+// ** /** //** /** /** /**
+// ** /** //** ******** /** /**
+// // // // //////// // //
+//
+// FRSH(FRescor ScHeduler), pronounced "fresh"
+//==============================================
+
+#ifndef FRSH_DISTRIBUTED_TYPES_H_
+#define FRSH_DISTRIBUTED_TYPES_H_
+
+/**
+ * @file frsh_distributed_types.h
+ **/
+
+#include "fna.h"
+
+FRSH_CPP_BEGIN_DECLS
+
+/**
+ * @addtogroup distributed
+ *
+ * @{
+ **/
+
+typedef fna_endpoint_data_t* frsh_send_endpoint_t;
+typedef fna_endpoint_data_t* frsh_receive_endpoint_t;
+typedef fna_endpoint_data_t* frsh_endpoint_t;
+
+/**
+ * The network_address type specifies the node or multicast address in
+ * a communication-protocol-independent way. The actual address is
+ * obtained via a configuration dependent mapping function
+ **/
+typedef unsigned int frsh_network_address_t;
+
+/**
+ * The port type specifies the information that is
+ * necessary to get in contact with the thread in the
+ * receiving node, in a protocol-independent way.
+ * The actual port number is obtained via a configuration
+ * dependent mapping function
+ **/
+typedef unsigned int frsh_stream_id_t;
+
+/**
+ * Extra information protocol dependent opaque for the application.
+ * It can be used in different places: contract negotiation, extra
+ * endpoint info, extra status info...
+ **/
+typedef struct {
+ void *body;
+ int size;
+} frsh_protocol_info_t;
+
+/**
+ * Protocol dependent information about the status of an endpoint
+ **/
+typedef struct {
+ void *body;
+ int size;
+} frsh_protocol_status_t;
+
+/**
+ * Protocol dependent information about extra parameters for
+ * send_endpoint definition.
+ **/
+typedef struct {
+ void *body;
+ int size;
+} frsh_send_endpoint_protocol_info_t;
+
+/**
+ * Protocol dependent information about extra parameters for
+ * receive_endpoint definition.
+ **/
+typedef struct {
+ void *body;
+ int size;
+} frsh_receive_endpoint_protocol_info_t;
+
+/**
+ * Algorithm used when the queue is full to choose the message to reject
+ **/
+typedef enum {
+ /** A new message is admitted rejecting the oldest message in the
+ queue to make room for the newcomer **/
+ FRSH_QRP_OLDEST,
+
+ /** Incoming messages are rejected if the queue is full **/
+ FRSH_QRP_NEWCOMER
+} frsh_queue_rejection_policy_t;
+
+/**
+ * Queing information for endpoints
+ **/
+typedef struct {
+ int queue_size; /** Size 0 means that there is no queue **/
+ frsh_queue_rejection_policy_t queue_policy;
+} frsh_endpoint_queueing_info_t;
+
+
+typedef enum {
+ /** Network works OK **/
+ FRSH_ENS_UP,
+
+ /** Network is down **/
+ FRSH_ENS_DOWN
+} frsh_endpoint_network_status_t;
+
+/*@}*/
+
+FRSH_CPP_END_DECLS
+
+#endif /* !FRSH_DISTRIBUTED_TYPES_H_ */