From ff14c3a38ad29e8617c11fc8f3868cc144eee318 Mon Sep 17 00:00:00 2001 From: sangorrin Date: Mon, 17 Nov 2008 17:30:40 +0000 Subject: [PATCH] add group negotiations to FNA interface git-svn-id: http://www.frescor.org/private/svn/frescor/fna/trunk@1397 35b4ef3e-fd22-0410-ab77-dab3279adceb --- include/fna.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/include/fna.h b/include/fna.h index 25992a8..7660afa 100644 --- a/include/fna.h +++ b/include/fna.h @@ -155,6 +155,66 @@ typedef uint16_t fna_vres_id_t; typedef frsh_vres_id_t fna_vres_id_t; #endif +typedef struct { + int size; + fna_vres_id_t vres[FRSH_MAX_GROUP_OPS]; +} fna_vres_group_t; + +/** + * frsh_group_change_mode_sync() + * + * This function performs a set of negotiation operations which can + * include: adding new contracts (neg), modifying existing vres (reneg) + * or cancelling existing vres (cancel). + * + * If one of the group operations has a NULL value, unless it causes an + * inconsistency the system will suppose that no operation of that + * type (neg, reneg or cancel) should be done. + * + * The virtual resources resulting from negotiations of new contracts are + * returned in the parameter 'new_vres' which must be provided by the user. + * + * If the on-line admission test is enabled, FRSH analizes the + * schedulability of the context that would result in the new + * contract situation with removed, changed and added contracts. + * + * A successful return code will mean that all contracts have been + * accepted and all required operations (creation, cancellation or + * update of vres) have been carried out to reach the new running + * context. + * + * If any of the contracts is not accepted a corresponding error shall be + * returned and no changes will be made to the previously running context. + * + * This call is a synchronous, potentially blocking operation. It + * returns when the system has rejected the contracts or accepted + * and made them effective. + * + * @param[in] contracts_to_neg List of new contracts to negotiate + * @param[in] contracts_to_reneg List of contracts to renegotiate + * @param[in] vres_to_reneg List of vres to renegotiate + * @param[in] vres_to_cancel List of vres to cancel + * @param[out] new_vres List of vres of new contracts. + * + * @return 0 if no error \n + * 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 + * + **/ +typedef int fna_group_change_mode_sync_t + (const frsh_resource_id_t resource_id, + const frsh_contracts_group_t *contracts_to_neg, + const frsh_contracts_group_t *contracts_to_reneg, + const fna_vres_group_t *vres_to_reneg, + const fna_vres_group_t *vres_to_cancel, + fna_vres_group_t *new_vres); + /** * fna_contract_negotiate() * @@ -735,7 +795,7 @@ typedef int fna_send_endpoint_get_status_t /** * fna_send_endpoint_bind_t() * - * This operation is a called from frsh_send_endpoint_bind and binds send + * This operation is a called from frsh_send_endpoint_bind and binds send * edpoint to vres. * * @param[in] endpoint the endpoint object. @@ -748,7 +808,7 @@ typedef int fna_send_endpoint_get_status_t * FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n * FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n **/ -typedef +typedef int fna_send_endpoint_bind_t(fna_endpoint_data_t *endpoint, fna_vres_id_t vres); /** @@ -765,7 +825,7 @@ int fna_send_endpoint_bind_t(fna_endpoint_data_t *endpoint, fna_vres_id_t vres); * FNA_ERR_RESOURCE_ID_INVALID: if we are not in charge of resource_id \n * FNA_ERR_BAD_ARGUMENT: if pointers are NULL \n **/ -typedef +typedef int fna_send_endpoint_unbind_t(fna_endpoint_data_t *endpoint); /** @@ -984,6 +1044,7 @@ typedef int fna_network_get_min_effective_budget_t typedef struct { fna_init_t *fna_init; + fna_group_change_mode_sync_t *fna_group_change_mode_sync; fna_contract_negotiate_t *fna_contract_negotiate; fna_contract_renegotiate_sync_t *fna_contract_renegotiate_sync; fna_contract_renegotiate_async_t *fna_contract_renegotiate_async; -- 2.39.2