]> rtime.felk.cvut.cz Git - frescor/fna.git/commitdiff
added fna files, starting its implementation, the rest return an error and write...
authorsangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Tue, 8 Apr 2008 08:44:54 +0000 (08:44 +0000)
committersangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Tue, 8 Apr 2008 08:44:54 +0000 (08:44 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fna/trunk@1087 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_frescan/frescan_fna.c [new file with mode: 0644]
src_frescan/frescan_fna.h [new file with mode: 0644]
src_frescan/frescan_frsh_fna.c [new file with mode: 0644]

diff --git a/src_frescan/frescan_fna.c b/src_frescan/frescan_fna.c
new file mode 100644 (file)
index 0000000..f1f4cbc
--- /dev/null
@@ -0,0 +1,984 @@
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politecnica  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
+//
+//        The 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
+//
+// This file is part of FNA (Frescor Network Adaptation)
+//
+// FNA 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.  FNA 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 FNA; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FNA header files in a file,
+// instantiating FNA generics or templates, or linking other files
+// with FNA 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.
+// -----------------------------------------------------------------------
+
+//==============================================
+//  ******** ****     **     **
+//  **///// /**/**   /**    ****
+//  **      /**//**  /**   **//**
+//  ******* /** //** /**  **  //**
+//  **////  /**  //**/** **********
+//  **      /**   //****/**//////**
+//  **      /**    //***/**     /**
+//  /       //      /// //      //
+//
+// FNA(Frescor Network Adaptation layer), pronounced "efe ene a"
+//==============================================================
+
+#include "frsh.h" /* frsh_resource_id_t, .. */
+#include "frescan.h" /* frescan_init, ... */
+#include "frescan_data.h" /* frescan_contract_t, ... */
+#include "frescan_bandwidth_reservation.h" /* frescan_bwres_init, ... */
+#include "fna.h" /* fna_vres_id_t, fna_endpoint_data_t */
+
+#undef ERROR
+#include "frescan_debug.h" /* DEBUG, ERROR */
+
+//////////////////////////////////////////////////////////////////////
+//           INITIALIZATION
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * frescan_fna_init()
+ *
+ * This function will be hooked to the frsh_init function and it is
+ * intented to initialize the protocol and its structures.
+ *
+ * @param[in]  resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_ALREADY_INITIALIZED:
+ *      if the function has already been called before (with success) \n
+ *
+ **/
+int frescan_fna_init(const frsh_resource_id_t resource_id)
+{
+        int ret;
+        frescan_init_params_t init_params;
+
+        // TODO: resource_id must be relative or sth
+        // TODO: init_params must be configurable
+        init_params.net = (frescan_network_t)resource_id;
+        init_params.node = (frescan_node_t)FRSH_CPU_ID_DEFAULT;
+        init_params.tx_fp_max_prio = 10;
+        init_params.rx_num_of_channels = 10;
+        init_params.rx_channel_max_prio = NULL;
+
+        DEBUG(FRESCAN_FNA_ENABLE_DEBUG, "Initializing FRESCAN\n");
+
+        ret = frescan_init(&init_params);
+        if (ret != 0) ERROR ("could not init FRESCAN");
+
+        DEBUG(FRESCAN_FNA_ENABLE_DEBUG, "Initializing BWRES\n");
+
+        ret = frescan_bwres_init(init_params.net);
+        if (ret != 0) ERROR ("could not init BWRES");
+
+        return 0;
+}
+
+///////////////////////////////////////////////////////////////////
+//           VIRTUAL RESOURCES
+///////////////////////////////////////////////////////////////////
+
+/**
+ * frescan_fna_contract_negotiate()
+ *
+ * The operation negotiates a contract and if accepted it will return
+ * a fna_vres_id_t. It will also check that the given contract_id is unique
+ * within the network.
+ *
+ * If the on-line admission test is enabled, it determines whether the
+ * contract can be admitted or not based on the current contracts
+ * established in the network. Then it creates the vres and
+ * recalculates all necessary parameters for the contracts already
+ * present in the system.
+ *
+ * This is a potentially blocking operation, it returns when the
+ * system has either rejected the contract, or admitted it and made it
+ * effective.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] contract  The contract parameters to negotiate
+ * @param[out] vres The internal virtual resource id
+ *
+ * @return
+ *   0 if there are no errors (in this case it also means contract accepted) \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_TOO_MANY_VRES: if there is no space for more vres \n
+ *   FNA_ERR_CONTRACT_ID_ALREADY_EXISTS: contract_id is not unique \n
+ *   FNA_ERR_CONTRACT_REJECTED: if the contract is not accepted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_contract_negotiate
+                (const frsh_resource_id_t resource_id,
+                 const frsh_contract_t *contract,
+                 fna_vres_id_t *vres)
+{
+        int accepted;
+        frescan_ss_t ss;
+        frescan_contract_t frescan_contract;
+
+        DEBUG(FRESCAN_FNA_ENABLE_DEBUG,
+              "convert frsh contract to frescan contract\n");
+
+        // TODO: budget is stored as number of can frames in tv_sec
+        frescan_contract.min_values.budget = contract->budget_min.tv_sec;
+        frescan_contract.min_values.period = contract->period_max;
+
+        frescan_contract.max_values.budget = contract->budget_max.tv_sec;
+        frescan_contract.max_values.period = contract->period_min;
+
+        frescan_contract.prio = contract->preemption_level;
+
+        DEBUG(FRESCAN_FNA_ENABLE_DEBUG, "calling frescan_bwres_negotiate\n");
+        accepted = frescan_bwres_negotiate((frescan_network_t)resource_id,
+                                           &frescan_contract,
+                                           &ss); // TODO: associate the contract with the ss
+
+        if (accepted == 0) {
+                DEBUG(FRESCAN_FNA_ENABLE_DEBUG, "contract accepted\n");
+                *vres = (fna_vres_id_t)ss;
+        } else {
+                DEBUG(FRESCAN_FNA_ENABLE_DEBUG, "contract not accepted\n");
+        }
+
+        return accepted;
+}
+
+/**
+ * frescan_fna_contract_renegotiate_sync()
+ *
+ * The operation renegotiates a contract for an existing vres. If
+ * the on-line admission test is enabled it determines whether the
+ * contract can be admitted or not based on the current contracts
+ * established in the system. If it cannot be admitted, the old
+ * contract remains in effect and an error is returned. If it can be
+ * admitted, it recalculates all necessary parameters for the
+ * contracts already present in the system and returns zero. This is a
+ * potentially blocking operation; it returns when the system has
+ * either rejected the new contract, or admitted it and made it
+ * effective.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id to renegotiate
+ * @param[in] new_contract The new contract
+ *
+ *  @return
+ *   0 if there are no errors (in this case it also means contract accepted) \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_CONTRACT_ID_ALREADY_EXISTS: contract_id is not unique \n
+ *   FNA_ERR_CONTRACT_REJECTED: if the contract is not accepted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_contract_renegotiate_sync
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 const frsh_contract_t *new_contract)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_contract_renegotiate_async()
+ *
+ * The operation enqueues a renegotiate operation for an existing
+ * vres, and returns immediately. The renegotiate operation is
+ * performed asynchronously, as soon as it is practical; meanwhile the
+ * system operation will continue normally. When the renegotiation is
+ * made, if the on-line admission test is enabled it determines
+ * whether the contract can be admitted or not based on the current
+ * contracts established in the system. If it cannot be admitted, the
+ * old contract remains in effect. If it can be admitted, it
+ * recalculates all necessary parameters for the contracts already
+ * present in the system.
+ *
+ * When the operation is completed, notification is made to the
+ * caller, if requested, via a signal. The status of the operation (in
+ * progress, admitted, rejected) can be checked with the
+ * frsh_vres_get_renegotiation_status() operation.  The argument
+ * sig_notify can be FRSH_NULL_SIGNAL (no notification), or any FRSH
+ * signal value and in this case signal_info is to be sent with the signal.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id to renegotiate
+ * @param[in] new_contract The new contract
+ * @param[in] signal_to_notify  Signal number to use to notify vres of
+ * the negotiation result. If FRSH_NULL_SIGNAL,  no signal will be raised.
+ * @param[in] signal_info: Associated info that will come with the signal.
+ * This parameter will be ignored if signal_to_notify == FRSH_NULL_SIGNAL.
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_CONTRACT_ID_ALREADY_EXISTS: contract_id is not unique \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL, or sig_notify is neither
+ *      NULL nor a valid POSIX signal \n
+ *
+ **/
+int frescan_fna_contract_renegotiate_async
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 const frsh_contract_t *new_contract,
+                 frsh_signal_t signal_to_notify,
+                 frsh_signal_info_t signal_info)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_get_renegotiation_status()
+ *
+ * The operation reports on the status of the last renegotiation
+ * operation enqueued for the specified vres. It is callable even
+ * after notification of the completion of such operation, if
+ * requested.
+ *
+ * If the vres is not and has not been involved in any of the
+ * frsh_contract_renegotiate_async() or frsh_group_change_mode_async()
+ * operations, the status returned is FNA_NOT_REQUESTED
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id we want the status from
+ * @param[in] renegotiation_status The status of the last renegotiation on
+ * vres (FRSH_RS_IN_PROGRESS, FRSH_RS_REJECTED, FRSH_RS_ADMITTED,
+ * FRSH_RS_NOT_REQUESTED)
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_vres_get_renegotiation_status
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 frsh_renegotiation_status_t *renegotiation_status)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_destroy()
+ *
+ * The operation eliminates the specified vres
+ * and recalculates all necessary parameters for the contracts
+ * remaining in the system. This is a potentially blocking operation;
+ * it returns when the system has made the changes effective.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id to destroy
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_vres_destroy
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_get_contract()
+ *
+ * This operation stores the contract parameters currently associated
+ * with the specified vres in the variable pointed to by
+ * contract. It returns an error if the vres_id is not recognised.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id
+ * @param[out] contract  The contract parameters that we want
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_vres_get_contract
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 frsh_contract_t *contract)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_get_usage()
+ *
+ * This function gets the execution time spent by all messages that have been
+ * sent through the specified vres.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id
+ * @param[out] usage  Execution time spent by this vres
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_vres_get_usage
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 struct timespec *usage)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_get_remaining_budget()
+ *
+ * This function stores in the variable pointed to by budget the
+ * remaining execution-time budget associated with the specified
+ * vres in the present period.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id
+ * @param[out] remaining_budget  The remaining budget for this period
+ *
+ *  @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_vres_get_remaining_budget
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 struct timespec *remaining_budget)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_get_budget_and_period()
+ *
+ * This function gets the budget and period associated with the specified vres
+ * for each period. If one of these pointers is NULL, the corresponding
+ * information is not stored.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id
+ * @param[out] budget The budget associated to vres
+ * @param[out] period  The period associated to vres
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if both pointers are NULL \n
+ *
+ **/
+int frescan_fna_vres_get_budget_and_period
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 struct timespec *budget,
+                 struct timespec *period)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/*@}*/
+
+///////////////////////////////////////////////////////////////////
+//           SPARE CAPACITY FUNCIONS
+///////////////////////////////////////////////////////////////////
+
+/**
+ * @defgroup fnaspare FNA Spare Capacity
+ * @ingroup fna
+ *
+ * The following functions are used to get spare capacity data
+ *
+ * @{
+ **/
+
+/**
+ * frescan_fna_resource_get_capacity()
+ *
+ * This operation gets the spare capacity currently assigned to a importance
+ * level. If we divide this value by UINT32_MAX we will get the network
+ * utilization associated to the spare capacity of a importance level.
+ *
+ * The following is typically in stdint.h: \n
+ *  - typedef unsigned int uint32_t;  \n
+ *  - # define UINT32_MAX  (4294967295U)  \n
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] importance The importance we want the capacity of
+ * @param[out] capacity The spare capacity for that importance level
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_resource_get_capacity
+                (const frsh_resource_id_t resource_id,
+                 const int importance,
+                 uint32_t *capacity)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_resource_get_total_weight()
+ *
+ * This function gets the sum of the weight parameters for all vres in a
+ * network of an importance level.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] importance The importance we want the total weight of
+ * @param[out] total_weight The total weight for that importance level
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_resource_get_total_weight
+                (const frsh_resource_id_t resource_id,
+                 const int importance,
+                 int *total_weight)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_vres_decrease_capacity()
+ *
+ * This function allows to ask for less budget and period than what we
+ * received. The request must be compatible with the rest of contract
+ * parameters of the vres. If we want to recover the released capacity
+ * we will need to renegotiate.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] vres The internal virtual resource id
+ * @param[in] new_budget The new_budget
+ * @param[in] new_period The new Period
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_CONTRACTED_VRES: if the vres is not contracted \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *   FNA_ERR_CONTRACT_REJECTED: if it is incompatible with the current
+ *      contract \n
+ *
+ **/
+int frescan_fna_vres_decrease_capacity
+                (const frsh_resource_id_t resource_id,
+                 const fna_vres_id_t vres,
+                 const struct timespec new_budget,
+                 const struct timespec new_period)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+///////////////////////////////////////////////////////////////////
+//           SEND RECEIVE OPERATIONS
+///////////////////////////////////////////////////////////////////
+
+/**
+ * frescan_fna_send_sync()
+ *
+ * Similar to previous function but now the sending thread gets blocked
+ * until the message is already sent to the network.
+ *
+ * @param[in] endpoint The send endpoint we are sending through. It must
+ *    be bound to a virtual resource (resource_id is in the endpoint).
+ * @param[in] msg The message we want to send
+ * @param[in] size The size in bytes of the message
+ *
+ * @returns
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_BOUND: if endpoint is not bound to a valid vres \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *   FNA_ERR_TOO_LARGE: if the message is too large for the network protocol \n
+ *   FNA_ERR_BUFFER_FULL: if the message has been discarded because
+ *   the queue is full (and does not have the policy FNA_QP_OLDEST) \n
+ *
+ **/
+int frescan_fna_send_sync
+                (const fna_endpoint_data_t *endpoint,
+                 const void *msg,
+                 const size_t size)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_send_async()
+ *
+ * This operation sends a message stored in msg and of length size
+ * through the given send endpoint. The operation is non-blocking and
+ * returns immediately.
+ *
+ * @param[in] endpoint The send endpoint we are sending through. It must
+ *    be bound to a virtual resource (resource_id is in the endpoint).
+ * @param[in] msg The message we want to send
+ * @param[in] size The size in bytes of the message
+ *
+ * @returns
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_BOUND: if endpoint is not bound to a valid vres \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *   FNA_ERR_TOO_LARGE: if the message is too large for the network protocol \n
+ *   FNA_ERR_BUFFER_FULL: if the message has been discarded because
+ *   the queue is full (and does not have the policy FNA_QP_OLDEST) \n
+ *
+ **/
+int frescan_fna_send_async
+                (const fna_endpoint_data_t *endpoint,
+                 const void *msg,
+                 const size_t size)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_receive_sync()
+ *
+ * This operation is used to receive messages from the network with a
+ * blocking behavior (if there are no messages this operation blocks
+ * the calling thread).
+ *
+ * When a message is available, it is copied to buffer (up to its size).
+ * The number of bytes copied is returned in received_bytes. The rest
+ * of the bytes of that message will be lost or not depending on the
+ * protocol (FNA_ERR_NO_SPACE will be returned if it is).
+ *
+ * The function fails with FNA_ERR_NO_SPACE if the buffersize is
+ * too small for the message received.  In this case the message is
+ * lost.
+ *
+ * Messages arriving at a receiver buffer that is full will be handled
+ * according to the queueing policy of the endpoint (overwrite oldest,
+ * discard it,etc).
+ *
+ * @param[in] endpoint The receive endpoint we are receiving from.
+ *    (resource_id is in the endpoint).
+ * @param[out] buffer Buffer for storing the received message
+ * @param[in] buffer_size The size in bytes of this buffer
+ * @param[out] received_bytes The actual number of received bytes
+ * @param[out] from Address of the sender node
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *   FNA_ERR_NO_SPACE: if the message size is bigger than the
+ *      provided buffer. \n
+ *
+ **/
+int frescan_fna_receive_sync
+                (const fna_endpoint_data_t *endpoint,
+                 void *buffer,
+                 const size_t buffer_size,
+                 size_t *received_bytes,
+                 frsh_network_address_t *from)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_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 FNA_NO_MESSAGE.
+ *
+ * @param[in] endpoint The receive endpoint we are receiving from.
+ *    (resource_id is in the endpoint).
+ * @param[out] buffer Buffer for storing the received message
+ * @param[in] buffer_size The size in bytes of this buffer
+ * @param[out] received_bytes The actual number of received bytes
+ * @param[out] from Address of the sender node
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *   FNA_ERR_NO_SPACE: if the message size is bigger than the
+ *      provided buffer. \n
+ *   FNA_NO_MESSAGE: if no messages are available in the queue. \n
+ *
+ **/
+int frescan_fna_receive_async
+                (const fna_endpoint_data_t *endpoint,
+                 void *buffer,
+                 const size_t buffer_size,
+                 size_t *received_bytes,
+                 frsh_network_address_t *from)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_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.
+ *
+ * @param[in] endpoint The send endpoint (resource_id is in the endpoint).
+ * @param[out] number_of_pending_messages The number of pending messages
+ * @param[out] network_status How is the network (up, down..)
+ * @param[out] protocol_status Protocol dependent status info
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_send_endpoint_get_status
+                (const fna_endpoint_data_t *endpoint,
+                 int *number_of_pending_messages,
+                 frsh_endpoint_network_status_t *network_status,
+                 frsh_protocol_status_t *protocol_status)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_receive_endpoint_created()
+ *
+ * This operation is a called from frsh_receive_endpoint_create with a
+ * receive_endpoint structure already filled.
+ *
+ * Receiving endpoints are not bound to any network vres, this is
+ * because don't originate any traffic.
+ *
+ * @param[in] endpoint the endpoint object.
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ **/
+int frescan_fna_receive_endpoint_created
+                (fna_endpoint_data_t *endpoint)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_receive_endpoint_get_pending_messages
+ *
+ * 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.
+ *
+ * @param[in] endpoint The receive endpoint (resource_id is in the endpoint).
+ * @param[out] number_of_pending_messages The number of pending messages
+ * @param[out] network_status How is the network (up, down..)
+ * @param[out] protocol_status Protocol dependent status info
+ *
+ * @return
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_receive_endpoint_get_status
+                (const fna_endpoint_data_t *endpoint,
+                 int *number_of_pending_messages,
+                 frsh_endpoint_network_status_t *network_status,
+                 frsh_protocol_status_t *protocol_status)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+//////////////////////////////////////////////////////////////////////
+//           NETWORK CONFIGURATION FUNCTIONS
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * frescan_fna_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
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ *   a network accessible from the current processing node \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL or destination is
+ *   invalid \n
+ *
+ **/
+int frescan_fna_network_get_max_message_size
+                (const frsh_resource_id_t resource_id,
+                 const frsh_network_address_t destination,
+                 size_t *max_size)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_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
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ *   a network accessible from the current processing node \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL or nbytes is less
+ *   than zero \n
+ *
+ **/
+int frescan_fna_network_bytes_to_budget
+                (const frsh_resource_id_t resource_id,
+                 const size_t nbytes,
+                 struct timespec *budget)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_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
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ *   a network accessible from the current processing node \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL or budget refers to
+ *   an invalid time value \n
+ *
+ **/
+int frescan_fna_network_budget_to_bytes
+                (const frsh_resource_id_t resource_id,
+                 const struct timespec *budget,
+                 size_t *nbytes)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frescan_fna_network_get_min_eff_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
+ *   0 if there are no errors \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if resource id does not represent
+ *   a network accessible from the current processing node \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frescan_fna_network_get_min_eff_budget
+                (const frsh_resource_id_t resource_id,
+                 struct timespec *budget)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+// GLOBAL variable to install the network protocol in FRESCOR
+
+fna_operations_t frescan_fna_operations = {
+        .fna_init = frescan_fna_init,
+        .fna_contract_negotiate = frescan_fna_contract_negotiate,
+        .fna_contract_renegotiate_sync = frescan_fna_contract_renegotiate_sync,
+        .fna_contract_renegotiate_async = frescan_fna_contract_renegotiate_async,
+        .fna_vres_get_renegotiation_status = frescan_fna_vres_get_renegotiation_status,
+        .fna_vres_destroy = frescan_fna_vres_destroy,
+        .fna_vres_get_contract = frescan_fna_vres_get_contract,
+        .fna_vres_get_usage = frescan_fna_vres_get_usage,
+        .fna_vres_get_remaining_budget = frescan_fna_vres_get_remaining_budget,
+        .fna_vres_get_budget_and_period = frescan_fna_vres_get_budget_and_period,
+        .fna_resource_get_capacity = frescan_fna_resource_get_capacity,
+        .fna_resource_get_total_weight = frescan_fna_resource_get_total_weight,
+        .fna_vres_decrease_capacity = frescan_fna_vres_decrease_capacity,
+        .fna_send_sync = frescan_fna_send_sync,
+        .fna_send_async = frescan_fna_send_async,
+        .fna_receive_sync = frescan_fna_receive_sync,
+        .fna_receive_async = frescan_fna_receive_async,
+        .fna_send_endpoint_get_status = frescan_fna_send_endpoint_get_status,
+        .fna_receive_endpoint_created = frescan_fna_receive_endpoint_created,
+        .fna_receive_endpoint_get_status = frescan_fna_receive_endpoint_get_status,
+        .fna_network_get_max_message_size = frescan_fna_network_get_max_message_size,
+        .fna_network_bytes_to_budget = frescan_fna_network_bytes_to_budget,
+        .fna_network_budget_to_bytes = frescan_fna_network_budget_to_bytes,
+        .fna_network_get_min_eff_budget = frescan_fna_network_get_min_eff_budget
+};
diff --git a/src_frescan/frescan_fna.h b/src_frescan/frescan_fna.h
new file mode 100644 (file)
index 0000000..a59908c
--- /dev/null
@@ -0,0 +1,74 @@
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politecnica  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
+//
+//        The 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
+//
+// This file is part of FNA (Frescor Network Adaptation)
+//
+// FNA 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.  FNA 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 FNA; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FNA header files in a file,
+// instantiating FNA generics or templates, or linking other files
+// with FNA 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.
+// -----------------------------------------------------------------------
+
+//==============================================
+//  ******** ****     **     **
+//  **///// /**/**   /**    ****
+//  **      /**//**  /**   **//**
+//  ******* /** //** /**  **  //**
+//  **////  /**  //**/** **********
+//  **      /**   //****/**//////**
+//  **      /**    //***/**     /**
+//  /       //      /// //      //
+//
+// FNA(Frescor Network Adaptation layer), pronounced "efe ene a"
+//==============================================================
+
+#ifndef _FRESCAN_FNA_H_
+#define _FRESCAN_FNA_H_
+
+#include "fna.h" // for fna_operations_t
+
+extern fna_operations_t frescan_fna_operations;
+
+#endif // _FRESCAN_FNA_H_
+
diff --git a/src_frescan/frescan_frsh_fna.c b/src_frescan/frescan_frsh_fna.c
new file mode 100644 (file)
index 0000000..c7bbbd6
--- /dev/null
@@ -0,0 +1,245 @@
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politecnica  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
+//
+//        The 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
+//
+// This file is part of FNA (Frescor Network Adaptation)
+//
+// FNA 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.  FNA 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 FNA; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
+//
+// As a special exception, including FNA header files in a file,
+// instantiating FNA generics or templates, or linking other files
+// with FNA 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.
+// -----------------------------------------------------------------------
+
+#include "frsh_fna.h"
+#include "frescan.h"
+
+#undef ERROR
+#include "frescan_debug.h"
+
+//////////////////////////////////////////////////////////////////////
+//           MAPPING FUNCTIONS
+//////////////////////////////////////////////////////////////////////
+
+/**
+ * frsh_XXXX_map_network_address()
+ *
+ * To map a XXXX protocol network address into a FRSH address.
+ * The protocol must keep this mapping consistent. Instead of using a function
+ * a hardwired mapping could be used.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] in_address The network address we want to map to a frsh address
+ * @param[out] out_address The FRSH abstract network address
+ *
+ * @return
+ *   FNA_NO_ERROR: in this case it also means contract accepted \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frsh_frescan_map_network_address
+      (const frsh_resource_id_t resource_id,
+       const frescan_node_t in_address,
+       frsh_network_address_t *out_address)
+{
+    if (out_address == NULL) return -1;
+    *out_address = in_address;
+    return 0;
+}
+
+/**
+ * frsh_XXXX_map_stream_id()
+ *
+ * To map a XXXX protocol network stream, port, channel... into a FRSH stream.
+ * The protocol must keep this mapping consistent. Instead of using a function
+ * a hardwired mapping could be used.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] in_stream The network stream we want to map to a FRSH stream
+ * @param[out] out_stream The FRSH abstract network stream
+ *
+ * @return
+ *   FNA_NO_ERROR: in this case it also means contract accepted \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frsh_frescan_map_stream_id
+      (const frsh_resource_id_t resource_id,
+       const frescan_channel_t in_stream,
+       frsh_stream_id_t *out_stream)
+{
+    if (out_stream == NULL) return -1;
+    *out_stream = in_stream;
+    return 0;
+}
+
+///////////////////////////////////////////////////////////////////
+//           NEGOTIATION SERVICE PARAMETERS
+///////////////////////////////////////////////////////////////////
+
+/**
+ * frsh_XXXX_negotiation_messages__vres_renegotiate()
+ *
+ * This function allows the application to change the minimum period
+ * of the negotiation messages sent through the network. It is similar
+ * to the service thread but for the network messages. We do not provide
+ * budget here because the size of the negotiation messages is fixed.
+ *
+ * This change is similar to a renegotiation so a schedulability test
+ * must be done to see if the change can be accepted or not.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] period The new period for negotiation messages
+ * @param[out] accepted If the change has been accepted or not
+ *
+ * @return
+ *   FNA_NO_ERROR: in this case it also means contract accepted \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+
+int frsh_frescan_negotiation_messages_vres_renegotiate
+      (const frsh_resource_id_t resource_id,
+       const struct timespec *period)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frsh_XXXX_negotiation_messages_vres_get_period()
+ *
+ * This function gets the minimum period of the negotiation messages
+ * sent through the network.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[out] period The period for negotiation messages
+ *
+ * @return
+ *   FNA_NO_ERROR: in this case it also means contract accepted \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frsh_frescan_negotiation_messages_vres_get_period
+      (const frsh_resource_id_t resource_id,
+       struct timespec *period)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frsh_XXXX_service_thread_vres_renegotiate()
+ *
+ * This function allows the application to change the period and
+ * budget of the service thread that makes the negotiations and
+ * schedulability tests in a network.
+ *
+ * The service thread starts with a default budget and period that
+ * should be configurable
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[in] budget The new budget for the service thread
+ * @param[in] period The new period for the service thread
+ * @param[out] accepted If the negotiation has been accepted or not
+ *
+ * @return
+ *   FNA_NO_ERROR: in this case it also means contract accepted \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frsh_frescan_service_thread_vres_renegotiate
+   (const frsh_resource_id_t resource_id,
+    const struct timespec *budget,
+    const struct timespec *period,
+    bool *accepted)
+{
+        ERROR("not implemented\n");
+        return -1;
+}
+
+/**
+ * frsh_XXXX_service_thread_vres_get_budget_and_period()
+ *
+ * This function gets the budget and period of a service thread.
+ *
+ * @param[in] resource_id The network we are referring to (a protocol
+ * could be able to handle several networks at the same time)
+ * @param[out] budget The budget of the service thread
+ * @param[out] period The period of the service thread
+ *
+ * @return
+ *   FNA_NO_ERROR: in this case it also means contract accepted \n
+ *   FNA_ERR_INTERNAL_ERROR: protocol dependent internal errors \n
+ *   FNA_ERR_NOT_INITIALIZED: if the protocol is not initialized \n
+ *   FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n
+ *   FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n
+ *
+ **/
+int frsh_frescan_service_thread_vres_get_budget_and_period
+      (const frsh_resource_id_t resource_id,
+       struct timespec *budget,
+       struct timespec *period)
+{
+        ERROR("not implemented\n");
+        return -1;
+}