const fna_vres_id_t vres,
const frsh_contract_t *new_contract)
{
- return 0;
+ rtep_bwres_contract_t rtep_contract;
+ int accepted;
+ int pos = (int) vres;
+
+ // convert FRSH contract to RTEP BWRES contract
+ rtep_contract.period_max = new_contract->period_max;
+ rtep_contract.deadline = new_contract->deadline;
+ rtep_contract.prio = new_contract->preemption_level;
+ // in RTEP BWRES, budget is given in number of packets. We do a little trick
+ // in the function bytes_to_network_budget to use a the field tv_sec from
+ // the timespec in frsh_contract to store the budget in bytes directly
+ rtep_contract.budget_min = new_contract->budget_min.tv_sec;
+
+ // renegotiate the contract
+ accepted = rtep_bwres_contract_renegotiate_sync
+ (&rtep_vres_list[pos], &rtep_contract);
+
+ return accepted;
}
/**