/*! ******************************************************************************* \brief La fonction formate en un message les parametres de la fonction rrm_open_freq(). \return message formate */ msg_t *msg_update_open_freq_7( Instance_t inst, L2_ID L2_id , unsigned int NB_ch, CHANNELS_DB_T *channels, //mod_lor_10_05_17 Transaction_t Trans_id ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; if ( msg != NULL ) { unsigned int size = sizeof( update_open_freq_t );// + (NB_free_ch-1) * sizeof(CHANNEL_T) ;//mod_lor_10_04_23 update_open_freq_t *p = RRM_CALLOC2(update_open_freq_t , size ) ; if ( p != NULL ) { init_ip_msg_head(&(msg->head),inst,UPDATE_OPEN_FREQ_7, size ,Trans_id); memcpy( p->L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; p->NB_chan = NB_ch ; if ( NB_ch > 0 ) { memcpy( p->channels , channels, NB_ch * sizeof(CHANNELS_DB_T) ) ; } } msg->data = (char *) p ; } return msg ; }
msg_t *msg_rrm_up_freq_ass( Instance_t inst , //!< instance ID L2_ID L2_id , //!< Layer 2 (MAC) ID of SU unsigned int NB_chan , CHANNEL_T *ass_channels ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; if ( msg != NULL ) { unsigned int size = sizeof( rrm_up_freq_ass_t );// + (NB_chan-1) * sizeof(CHANNEL_T) ;//mod_lor_10_04_23 rrm_up_freq_ass_t *p = RRM_CALLOC2( rrm_up_freq_ass_t , size ) ; if ( p != NULL ) { init_rrc_msg_head(&(msg->head),inst,RRM_UP_FREQ_ASS, size,0); p->NB_chan = NB_chan; memcpy( p->L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; memcpy( p->ass_channels, ass_channels, NB_chan*sizeof(CHANNEL_T) ); } msg->data = (char *) p ; } return msg ; }
msg_t *msg_rrm_scan_ord( Instance_t inst , ///< instance ID unsigned int NB_chan , ///< Number of channels to sens unsigned int Meas_tpf , ///< time on each carrier //mod_lor_10_02_19 unsigned int Overlap , ///< overlap factor (percentage) //mod_lor_10_02_19 unsigned int Sampl_nb , ///< number of samples per sub-band //mod_lor_10_04_01 Sens_ch_t *ch_to_scan , ///< Vector of channels to scan //mod_lor_10_02_19 Transaction_t Trans_id ///< Transaction ID ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; if ( msg != NULL ) { unsigned int size; /*if ( NB_chan != 0 ){ size = sizeof( rrm_scan_ord_t ) + (NB_chan-1) * sizeof(unsigned int) ; }else*/ size = sizeof( rrm_scan_ord_t ); rrm_scan_ord_t *p = RRM_CALLOC2(rrm_scan_ord_t , size ) ; if ( p != NULL ) { init_sensing_msg_head(&(msg->head),inst,RRM_SCAN_ORD, size ,Trans_id); p->Meas_tpf = Meas_tpf; //mod_lor_10_02_19 p->Overlap = Overlap; //mod_lor_10_02_19 p->Sampl_nb = Sampl_nb; //mod_lor_10_02_19 p->NB_chan = NB_chan; if ( NB_chan != 0 ){ memcpy( p->ch_to_scan, ch_to_scan, NB_chan*sizeof(Sens_ch_t) ); } for (int i=0; i<NB_chan;i++) printf("scan_ord i :%d, start %d, end %d sampl %d\n",i,p->ch_to_scan[i].Start_f,p->ch_to_scan[i].Final_f,Sampl_nb); } msg->data = (char *) p ; } return msg ; }
msg_t *msg_update_sens_results_3( Instance_t inst, L2_ID L2_id, //!< FC L2_id unsigned int NB_info, Sens_ch_t *Sens_meas, Transaction_t Trans_id ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; if ( msg != NULL ) { unsigned int size = sizeof( rrm_update_sens_t );// + (NB_info-1) * sizeof(Sens_ch_t) ; //mod_lor_10_04_23 rrm_update_sens_t *p = RRM_CALLOC2(rrm_update_sens_t , size ) ; if ( p != NULL ) { //fprintf(stderr,"rrmUSR 1 \n");//dbg init_ip_msg_head(&(msg->head),inst, UPDATE_SENS_RESULTS_3, size ,Trans_id); memcpy( p->L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; p->NB_info = NB_info ; p->info_time = 0 ; if ( NB_info > 0 ) { memcpy( p->Sens_meas , Sens_meas, NB_info * sizeof(Sens_ch_t) ) ; } //fprintf(stdout,"msg_rrm_update_sens()2 : NB_chan %d\n", p->NB_info);//dbg //fprintf(stdout,"NB_chan %d\n", p->NB_info); // for (int i=0; i<NB_info; i++) // Sens_ch_t *ch = p->Sens_meas; ch!=NULL; ch=ch->next) //fprintf(stdout,"channel in msg arr: %d\n", ch->Ch_id); //dbg } //fprintf(stderr,"rrmUSR end \n");//dbg msg->data = (char *) p ; } return msg ; }
msg_t *msg_update_SN_occ_freq_5( Instance_t inst , //!< instance ID L2_ID L2_id , //!< Layer 2 (MAC) ID of FC unsigned int NB_chan , unsigned int *occ_channels , Transaction_t Trans_id //!< Transaction ID ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; //fprintf(stdout,"rrc_end_scan_ord() cp1\n"); //dbg if ( msg != NULL ) { unsigned int size = sizeof( update_SN_occ_freq_t );// + (NB_chan-1) * sizeof(unsigned int) ;//mod_lor_10_04_23 update_SN_occ_freq_t *p = RRM_CALLOC2(update_SN_occ_freq_t , size ) ; if ( p != NULL ) { init_ip_msg_head(&(msg->head),inst,UPDATE_SN_OCC_FREQ_5, size,Trans_id); memcpy( p->L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; p->NB_chan = NB_chan; if ( NB_chan != 0 ){ memcpy( p->occ_channels, occ_channels, NB_chan*sizeof(unsigned int) ); } } msg->data = (char *) p ; } return msg ; }
msg_t *msg_rrm_up_freq_ass_sec( Instance_t inst , //!< instance ID L2_ID *L2_id , //!< Layer 2 (MAC) ID vector of SUs starting tx L2_ID *L2_id_dest , //!< Layer 2 (MAC) ID vector of SUs receiving tx unsigned int NB_all , //!< Number of allocated links CHANNEL_T *ass_channels //!< Vector of allocated links ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; int i; if ( msg != NULL ) { unsigned int size = sizeof( rrm_up_freq_ass_sec_t ); //printf ("size rrm_up_freq_ass_t %d\n", size);//dbg rrm_up_freq_ass_sec_t *p = RRM_CALLOC2( rrm_up_freq_ass_sec_t , size ) ; if ( p != NULL ) { init_rrc_msg_head(&(msg->head),inst,RRM_UP_FREQ_ASS_SEC, size,0); p->NB_all = NB_all; for (i=0; i<NB_all; i++) { memcpy( p->L2_id[i].L2_id, L2_id[i].L2_id, sizeof(L2_ID) ) ; memcpy( p->L2_id_dest[i].L2_id, L2_id_dest[i].L2_id, sizeof(L2_ID) ) ; } memcpy( p->ass_channels, ass_channels, NB_all*sizeof(CHANNEL_T) ); } msg->data = (char *) p ; } return msg ; }
msg_t *msg_rrm_init_mon_req( Instance_t inst , //!< instance ID L2_ID L2_id , unsigned int NB_chan , unsigned int interval , unsigned int *ch_to_scan , Transaction_t Trans_id //!< Transaction ID ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; if ( msg != NULL ) { unsigned int size = sizeof( rrm_init_mon_req_t ) + (NB_chan-1) * sizeof(unsigned int) ; rrm_init_mon_req_t *p = RRM_CALLOC2(rrm_init_mon_req_t , size ) ; if ( p != NULL ) { //for (int i=0; i<NB_chan; i++) // fprintf(stdout,"msg_rrm_init_mon_req(), chan: %d\n", ch_to_scan[i]); //dbg init_rrc_msg_head(&(msg->head),inst,RRM_INIT_MON_REQ, size ,Trans_id); memcpy( p->L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; p->NB_chan = NB_chan; p->interval = interval; if ( NB_chan != 0 ) memcpy( p->ch_to_scan, ch_to_scan, NB_chan*sizeof(unsigned int) ); } msg->data = (char *) p ; } return msg ; }
msg_t *msg_up_clust_sens_results( Instance_t inst, L2_ID L2_id, //!< FC L2_id unsigned int NB_info, unsigned int info_value, Sens_ch_t *Sens_meas, Transaction_t Trans_id ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; if ( msg != NULL ) { unsigned int size = sizeof( update_coll_sens_t );// + (NB_info-1) * sizeof(Sens_ch_t) ; //mod_lor_10_04_23 update_coll_sens_t *p = RRM_CALLOC2(update_coll_sens_t , size ) ; if ( p != NULL ) { init_ip_msg_head(&(msg->head),inst, UP_CLUST_SENS_RESULTS, size ,Trans_id); memcpy( p->L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) ) ; p->NB_info = NB_info ; p->info_time = 0 ; p->info_value = info_value; if ( NB_info > 0 ) { memcpy( p->Sens_meas , Sens_meas, NB_info * sizeof(Sens_ch_t) ) ; } } msg->data = (char *) p ; } return msg ; }
msg_t *msg_rrm_end_scan_ord( Instance_t inst , //!< instance ID unsigned int NB_chan , unsigned int *channels , Transaction_t Trans_id //!< Transaction ID ) { msg_t *msg = RRM_CALLOC(msg_t , 1 ) ; //fprintf(stdout,"rrc_end_scan_ord() cp1\n"); //dbg if ( msg != NULL ) { unsigned int size = sizeof( rrm_end_scan_ord_t ); //+ (NB_chan-1) * sizeof(unsigned int) ; rrm_end_scan_ord_t *p = RRM_CALLOC2(rrm_end_scan_ord_t , size ) ; if ( p != NULL ) { init_sensing_msg_head(&(msg->head),inst,RRM_END_SCAN_ORD, size,Trans_id); p->NB_chan = NB_chan; if ( NB_chan != 0 ){ memcpy( p->channels, channels, NB_chan*sizeof(unsigned int) ); } } msg->data = (char *) p ; } return msg ; }