for(i=0; i<size; i++) {
ret[i] = '0';
}
+ return ret;
}
int send_data(struct stream_params *p)
{
- frsh_contract_t contract;
+ struct fres_contract * contract;
frsh_rel_time_t period;
frsh_rel_time_t budget;
frsh_rel_time_t deadline;
int size_of_budget_actual = p->budget;
- int size_of_budget_old;
int size_of_period_ms = p->period_ms;
/* ----------------------------- */
- fwp_vres_t *vres;
- struct fwp_vres_params vparam;
- char buffer[30];
- struct fwp_endpoint *sepoint, *repoint;
+ struct fres_vres * vres;
+ //struct fwp_vres_params * vparam;
+ struct fna_endpoint_data * sepoint;
fwp_endpoint_attr_t attr;
int num;
num = 0;
char * msg;
msg = prepare_msg(size_of_budget_actual);
- fres_block_fwp_sched *fwp_sched;
-
fwp_init();
frsh_send_endpoint_protocol_info_t send_pinfo;
fwp_block = (fres_block_fwp*)malloc(sizeof(fres_block_fwp));
/*Add mac address for each contract*/
- //TODO: Get local address
- fwp_block->mac_address = 98422970084; //get_local_mac("wlan0");
+ //TODO: Get local address automatically
+ fwp_block->mac_address = 2970084; //get_local_mac("wlan0");
fres_contract_add_block(contract, FRES_BLOCK_FWP, fwp_block);
- /* --------------------------- */
fwp_endpoint_attr_init(&attr);
-
+
+ //probably no need to deal with virtual resources
+ /*
vparam.ac_id = FWP_AC_VO;
vparam.budget = size_of_budget_actual;
vparam.period.tv_sec = 0;
vparam.period.tv_nsec = size_of_period_ms*1000*1000;
-
- printf("Start\n");
-
printf("Create VRES\n");
- if (fwp_vres_create(&vparam, &vres) < 0) {
+ if (fwp_vres_create(vparam, (fwp_vres_t **)&vres) < 0) {
printf("Unable to create VRES\n");
return -1;
}
printf("VRES created \n");
+ */
+ printf("Start\n");
+
//contract negotioate function
if ((frsh_contract_negotiate(&contract, &vres)) != 0) {
printf("not negotiated\n");
frsh_contract_cancel(vres);
size_of_budget_actual = size_of_budget_actual - 100;
- frsh_contract_cancel(vres);
- frsh_contract_destroy(contract);
+ frsh_contract_cancel((frsh_vres_id_t)&vres);
+ frsh_contract_destroy(&contract);
continue;
}
free(msg);
frsh_contract_cancel(vres);
- frsh_contract_destroy(contract);
+ frsh_contract_destroy(&contract);
sleep(1);
}
/*
int main(void)
{
- int i;
int num = 0;
struct stream_params sp = {