astyle --recursive --indent=spaces=2 --style=kr --indent-col1-comments --break-blocks --convert-tabs --max-code-length=200

This is done for better merging branch/LG_PRE_RELEASE_0.3 into trunk (same process is applied on this branch)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7073 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Lionel Gauthier
2015-04-09 09:29:12 +00:00
parent f0a8a0b3b5
commit 059a0a3fdc
2044 changed files with 1182666 additions and 1145123 deletions
+285 -281
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file main.c
* \brief main program for OTG CX + RX
* \brief main program for OTG CX + RX
* \author A. Hafsaoui
* \date 2011
* \version 0.1
@@ -55,216 +55,218 @@
int SIMU_TIME=1200000;
int SIMU_TIME=1200000;
int simu_time=0, duration=0, seed=0, simu_mode=0;
// init OTG with config parameters
void init_config_otg(char *protocol, char *ip_version) {
void init_config_otg(char *protocol, char *ip_version)
{
int i, j, k;
int i, j, k;
if (simu_time>0)
SIMU_TIME=simu_time;
if (simu_time>0)
SIMU_TIME=simu_time;
printf("OTG :: INIT CONFIG\n");
printf("OTG :: INIT CONFIG\n");
if (seed>0)
g_otg->seed=seed;
else
g_otg->seed=ceil(uniform_rng()*67534);
if (seed>0)
g_otg->seed=seed;
else
g_otg->seed=ceil(uniform_rng()*67534);
printf("duration %d, seeds %d \n", duration, g_otg->seed);
printf("duration %d, seeds %d \n", duration, g_otg->seed);
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++){
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
if (duration>0)
g_otg->duration[i]=duration;
else
g_otg->duration[i]=10000;
g_otg->dst_port[i]=DST_PORT;
g_otg->dst_ip[i]=(char*)malloc(100*sizeof(char*));
g_otg->dst_ip[i]=DST_IP;
g_otg->dst_ip[i]=DST_IP;
//config ip version
if (ip_version !=NULL){
if ((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0))
g_otg->ip_v[i]=IPV4;
else if ((strcmp(ip_version,"IP6")==0) ||(strcmp(ip_version,"ip6")==0))
g_otg->ip_v[i]=IPV6;
}
else
g_otg->ip_v[i]=IPV4;
if (duration>0)
g_otg->duration[i]=duration;
else
g_otg->duration[i]=10000;
//config transport protocol version
if (protocol!=NULL){
if ((strcmp(protocol,"TCP")==0) ||(strcmp(protocol,"tcp")==0))
g_otg->trans_proto[i]=TCP;
else if ((strcmp(protocol,"UDP")==0) ||(strcmp(protocol,"udp")==0))
g_otg->trans_proto[i]=UDP;
}
else
g_otg->trans_proto[i]=TCP;
g_otg->dst_port[i]=DST_PORT;
g_otg->dst_ip[i]=(char*)malloc(100*sizeof(char*));
g_otg->dst_ip[i]=DST_IP;
g_otg->dst_ip[i]=DST_IP;
//config ip version
if (ip_version !=NULL) {
if ((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0))
g_otg->ip_v[i]=IPV4;
else if ((strcmp(ip_version,"IP6")==0) ||(strcmp(ip_version,"ip6")==0))
g_otg->ip_v[i]=IPV6;
} else
g_otg->ip_v[i]=IPV4;
//config transport protocol version
if (protocol!=NULL) {
if ((strcmp(protocol,"TCP")==0) ||(strcmp(protocol,"tcp")==0))
g_otg->trans_proto[i]=TCP;
else if ((strcmp(protocol,"UDP")==0) ||(strcmp(protocol,"udp")==0))
g_otg->trans_proto[i]=UDP;
} else
g_otg->trans_proto[i]=TCP;
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
g_otg->application_type[i][j]=OPENARENA;
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++) {
LOG_I(OTG,"INIT CONFIG Source =%d, Destination =%d,State =%d \n",i, j, k);
g_otg->idt_dist[i][j][k]=IDT_DIST;
g_otg->idt_min[i][j][k]=IDT_MIN;
g_otg->idt_max[i][j][k]=IDT_MAX;
g_otg->idt_std_dev[i][j][k]=IDT_STD_DEV;
g_otg->idt_lambda[i][j][k]=IDT_LAMBDA;
g_otg->size_dist[i][j][k]=PKTS_SIZE_DIST;
g_otg->size_min[i][j][k]=PKTS_SIZE_MIN;
g_otg->size_max[i][j][k]=PKTS_SIZE_MAX;
g_otg->size_std_dev[i][j][k]=PKTS_SIZE_STD_DEV;
g_otg->size_lambda[i][j][k]=PKTS_SIZE_LAMBDA;
}
}
}
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++){
g_otg->application_type[i][j]=OPENARENA;
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++){
LOG_I(OTG,"INIT CONFIG Source =%d, Destination =%d,State =%d \n",i, j, k);
g_otg->idt_dist[i][j][k]=IDT_DIST;
g_otg->idt_min[i][j][k]=IDT_MIN;
g_otg->idt_max[i][j][k]=IDT_MAX;
g_otg->idt_std_dev[i][j][k]=IDT_STD_DEV;
g_otg->idt_lambda[i][j][k]=IDT_LAMBDA;
g_otg->size_dist[i][j][k]=PKTS_SIZE_DIST;
g_otg->size_min[i][j][k]=PKTS_SIZE_MIN;
g_otg->size_max[i][j][k]=PKTS_SIZE_MAX;
g_otg->size_std_dev[i][j][k]=PKTS_SIZE_STD_DEV;
g_otg->size_lambda[i][j][k]=PKTS_SIZE_LAMBDA;
}
}
}
}
int main_below_ip()
{
int i, j, k, l, rtt_owd ,rx_otg=0, simu_time=0, ctime=0, nb_round=0;
float p;
char *packet;
int rx_packet_out;
int pkt_size;
printf(" max enb %d, max ue %d \n", NUMBER_OF_eNB_MAX, NUMBER_OF_UE_MAX);
int i, j, k, l, rtt_owd ,rx_otg=0, simu_time=0, ctime=0, nb_round=0;
float p;
char *packet;
int rx_packet_out;
int pkt_size;
printf(" max enb %d, max ue %d \n", NUMBER_OF_eNB_MAX, NUMBER_OF_UE_MAX);
do {
do {
nb_round=nb_round+1;
// for (stime=0; stime < SIMU_TIME; stime++) // discrete event generation : tick, stime generate the ctime
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++){
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++){
nb_round=nb_round+1;
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++){
LOG_I(OTG,"OTG emulation src=%d, dst=%d, state=%d \n", i, j, k);
// for (stime=0; stime < SIMU_TIME; stime++) // discrete event generation : tick, stime generate the ctime
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
ctime=0; // set the ctime to 0
do {
if (simu_time> SIMU_TIME){
otg_info->ctime=SIMU_TIME;
return(0);
}
LOG_I(OTG,"val :: ctime=%d\n", ctime);
char *packet=NULL;
/*packet=packet_gen(i, j, k, ctime);*/ packet=packet_gen(i, j, ctime, &pkt_size);
if (packet!=NULL){
if ((ceil(g_otg->duration[i]*uniform_rng()))==ctime) {
printf("DROP PACKET (i=%d,j=%d) seq num=%d\n",i, j, otg_info->seq_num[i][j]);
}
else {
printf("SEND PACKET (i=%d,j=%d) seq num=%d\n",i, j, otg_info->seq_num[i][j]);
rtt_owd=ceil(uniform_rng()*8.56);
LOG_I(OTG,"one way delay= %d , (src=%d, dst=%d, state=%d)\n", rtt_owd, i, j, k);
ctime+=rtt_owd;
otg_info->rx_pkt_owd[i][j]=rtt_owd;
simu_time+=rtt_owd;
//rx_packet_out=check_packet(i, j, ctime, packet);
rx_packet_out=otg_rx_pkt(i,j, ctime, packet, pkt_size);
//if (rx_packet_out==NULL)
// LOG_I(OTG,"PKTS INFO:: DROPED\n");
//else{
// if (rx_packet_out!=NULL){
// rx_packet_out=NULL;
free(packet);
// }
//}
//Do not increase the ctime and simu_time with the one way delay.
ctime-=rtt_owd;
simu_time-=rtt_owd;
LOG_I(OTG,"PKTS INFO:: (src=%d, dst=%d, state=%d),NB PKTS=%d ,sequence NB=%d, RTT (one way)ms= %d \n ",i, j, k, otg_info->tx_num_pkt[i][j], otg_info->seq_num[i][j], otg_info->rx_pkt_owd[i][j]);
}
}
else
printf("Node (i=%d,j=%d) seq num=%d, ctime %d, prb %lf\n",i, j, otg_info->seq_num[i][j], ctime,(ceil(g_otg->duration[i]*uniform_rng())));
LOG_I(OTG,"Time:: ctime=%d, duration=%d, simu_time=%d, max=%d, (src=%d, dst=%d, state=%d) \n", ctime, g_otg->duration[i],simu_time, SIMU_TIME, i, j,k);
ctime+=1;
simu_time+=1;
}
while (ctime<=g_otg->duration[i]) ;
}
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++) {
LOG_I(OTG,"OTG emulation src=%d, dst=%d, state=%d \n", i, j, k);
if (otg_info->tx_num_pkt[i][j]>otg_info->rx_num_pkt[i][j])
LOG_I(OTG,"STAT: (LOSS):: (src=%d, dst=%d) NB packet TX= %d, NB packet RX = %d, seq NUM=%d\n ",i, j, otg_info->tx_num_pkt[i][j], otg_info->rx_num_pkt[i][j],otg_info->seq_num[i][j] );
else
LOG_I(OTG,"STAT: :: (src=%d, dst=%d) NB packet TX= %d, NB packet RX= %d, seq NUM=%d \n ",i, j, otg_info->tx_num_pkt[i][j], otg_info->rx_num_pkt[i][j], otg_info->seq_num[i][j]);
ctime=0; // set the ctime to 0
do {
if (simu_time> SIMU_TIME) {
otg_info->ctime=SIMU_TIME;
return(0);
}
LOG_I(OTG,"val :: ctime=%d\n", ctime);
char *packet=NULL;
/*packet=packet_gen(i, j, k, ctime);*/ packet=packet_gen(i, j, ctime, &pkt_size);
}
}
if (packet!=NULL) {
if ((ceil(g_otg->duration[i]*uniform_rng()))==ctime) {
printf("DROP PACKET (i=%d,j=%d) seq num=%d\n",i, j, otg_info->seq_num[i][j]);
} else {
printf("SEND PACKET (i=%d,j=%d) seq num=%d\n",i, j, otg_info->seq_num[i][j]);
}while (simu_time<=SIMU_TIME);
rtt_owd=ceil(uniform_rng()*8.56);
LOG_I(OTG,"one way delay= %d , (src=%d, dst=%d, state=%d)\n", rtt_owd, i, j, k);
ctime+=rtt_owd;
otg_info->rx_pkt_owd[i][j]=rtt_owd;
simu_time+=rtt_owd;
//rx_packet_out=check_packet(i, j, ctime, packet);
rx_packet_out=otg_rx_pkt(i,j, ctime, packet, pkt_size);
//if (rx_packet_out==NULL)
// LOG_I(OTG,"PKTS INFO:: DROPED\n");
//else{
// if (rx_packet_out!=NULL){
// rx_packet_out=NULL;
free(packet);
// }
//}
//Do not increase the ctime and simu_time with the one way delay.
ctime-=rtt_owd;
simu_time-=rtt_owd;
LOG_I(OTG,"PKTS INFO:: (src=%d, dst=%d, state=%d),NB PKTS=%d ,sequence NB=%d, RTT (one way)ms= %d \n ",i, j, k, otg_info->tx_num_pkt[i][j], otg_info->seq_num[i][j], otg_info->rx_pkt_owd[i][j]);
}
} else
printf("Node (i=%d,j=%d) seq num=%d, ctime %d, prb %lf\n",i, j, otg_info->seq_num[i][j], ctime,(ceil(g_otg->duration[i]*uniform_rng())));
LOG_I(OTG,"Time:: ctime=%d, duration=%d, simu_time=%d, max=%d, (src=%d, dst=%d, state=%d) \n", ctime, g_otg->duration[i],simu_time, SIMU_TIME, i, j,k);
ctime+=1;
simu_time+=1;
} while (ctime<=g_otg->duration[i]) ;
}
if (otg_info->tx_num_pkt[i][j]>otg_info->rx_num_pkt[i][j])
LOG_I(OTG,"STAT: (LOSS):: (src=%d, dst=%d) NB packet TX= %d, NB packet RX = %d, seq NUM=%d\n ",i, j, otg_info->tx_num_pkt[i][j], otg_info->rx_num_pkt[i][j],otg_info->seq_num[i][j] );
else
LOG_I(OTG,"STAT: :: (src=%d, dst=%d) NB packet TX= %d, NB packet RX= %d, seq NUM=%d \n ",i, j, otg_info->tx_num_pkt[i][j], otg_info->rx_num_pkt[i][j], otg_info->seq_num[i][j]);
}
}
} while (simu_time<=SIMU_TIME);
}
int main_above_ip()
{
int i, j, k, simu_time=0, ctime=0, nb_round=0;
char *packet=NULL;
printf(" max enb %d, max ue %d \n", NUMBER_OF_eNB_MAX, NUMBER_OF_UE_MAX);
do {
nb_round=nb_round+1;
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++){
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++){
int i, j, k, simu_time=0, ctime=0, nb_round=0;
char *packet=NULL;
printf(" max enb %d, max ue %d \n", NUMBER_OF_eNB_MAX, NUMBER_OF_UE_MAX);
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++){
LOG_I(OTG,"SOCKET:: OTG emulation src=%d, dst=%d, state=%d \n", i, j, k);
ctime=0;
// socket_packet_send(i, j, k, ctime);
}
}
}
do {
nb_round=nb_round+1;
ctime+=1;
simu_time+=1;
}while (simu_time<=SIMU_TIME);
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
for (k=0; k<MAX_NUM_TRAFFIC_STATE; k++) {
LOG_I(OTG,"SOCKET:: OTG emulation src=%d, dst=%d, state=%d \n", i, j, k);
ctime=0;
// socket_packet_send(i, j, k, ctime);
}
}
}
ctime+=1;
simu_time+=1;
} while (simu_time<=SIMU_TIME);
}
@@ -274,177 +276,179 @@ simu_time+=1;
void config_traffic_type(char *traffic)
{
Application application;
int i,j;
if (strcmp(traffic, "SCBR")==0)
application=SCBR;
Application application;
int i,j;
else if (strcmp(traffic, "OPENARENA")==0)
application=OPENARENA;
else if (strcmp(traffic, "BICYCLE_RACE")==0)
application=BICYCLE_RACE;
if (strcmp(traffic, "SCBR")==0)
application=SCBR;
else if (strcmp(traffic, "AUTO_PILOT")==0)
application=AUTO_PILOT;
else if (strcmp(traffic, "OPENARENA")==0)
application=OPENARENA;
else if (strcmp(traffic, "TEAM_FORTRESS")==0)
application=TEAM_FORTRESS;
else if (strcmp(traffic, "BICYCLE_RACE")==0)
application=BICYCLE_RACE;
else
application=NO_PREDEFINED_TRAFFIC;
else if (strcmp(traffic, "AUTO_PILOT")==0)
application=AUTO_PILOT;
printf("Config Application: %d \n", application);
else if (strcmp(traffic, "TEAM_FORTRESS")==0)
application=TEAM_FORTRESS;
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++){
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++){
else
application=NO_PREDEFINED_TRAFFIC;
g_otg->application_type[i][j] =application;
printf("Config Application: %d \n", application);
}
}
for (i=0; i<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); i++) {
for (j=0; j<(NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX); j++) {
g_otg->application_type[i][j] =application;
}
}
}
cunstom_config(simu_time, duration)
{ int i;
{
int i;
//--config introduced Global simulation time for each node
if (simu_time>0)
SIMU_TIME=simu_time;
//--config introduced Global simulation time for each node
if (simu_time>0)
SIMU_TIME=simu_time;
//--config introduced duartion for each node
if (duration>0)
for (i=0; i<NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++){
g_otg->duration[i] = duration;
}
//--config introduced duartion for each node
if (duration>0)
for (i=0; i<NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) {
g_otg->duration[i] = duration;
}
}
int main (int argc, char **argv){
int main (int argc, char **argv)
{
int i,j, tx;
char *protocol=NULL;
char *ip_version=NULL;
char *traffic=NULL;
int i,j, tx;
char *protocol=NULL;
char *ip_version=NULL;
char *traffic=NULL;
init_all_otg();
otg_info->ctime=0;
LOG_I(OTG,"Emulation time %d \n ", otg_info->ctime);
g_otg->num_nodes=NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX;
LOG_I(OTG,"OTG emulation number of nodes= %d \n", g_otg->num_nodes);
init_all_otg();
otg_info->ctime=0;
LOG_I(OTG,"Emulation time %d \n ", otg_info->ctime);
g_otg->num_nodes=NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX;
LOG_I(OTG,"OTG emulation number of nodes= %d \n", g_otg->num_nodes);
for (i = 1; i <argc ; i ++){
if ('-' == argv[i][0]) {
if(('h' == argv[i][1]) || ('H' == argv[i][1])) {
printf("Help OTG: \n./otg [-M [s (socket mode)] [b (Below IP)]] [-T (Simu Time)] [-d (duration per node)] [-s (seed)] [-P (protocol: TCP or UDP)] [-I (ip version: IP4 or IP6)] -A [(application: CBR, AUTO_PILOT, BICYCLE_RACE, OPENARENA, TEAM_FORTRESS)]\n");
return(0);
}
else if ('M' == argv[i][1]) {
if (strcmp("s",argv[i+1])==0){
printf("Above IP: SOCKET MODE \n");
simu_mode=1;
}
else if (strcmp("b",argv[i+1])==0) {
printf("Below IP: IPC/RPC MODE\n");
simu_mode=0;
}
}
for (i = 1; i <argc ; i ++) {
if ('-' == argv[i][0]) {
else if ('T' == argv[i][1]) {
simu_time=atoi(argv[i+1]);
printf("simu_time=%d\n", simu_time);
}
if(('h' == argv[i][1]) || ('H' == argv[i][1])) {
printf("Help OTG: \n./otg [-M [s (socket mode)] [b (Below IP)]] [-T (Simu Time)] [-d (duration per node)] [-s (seed)] [-P (protocol: TCP or UDP)] [-I (ip version: IP4 or IP6)] -A [(application: CBR, AUTO_PILOT, BICYCLE_RACE, OPENARENA, TEAM_FORTRESS)]\n");
return(0);
}
else if ('M' == argv[i][1]) {
if (strcmp("s",argv[i+1])==0) {
printf("Above IP: SOCKET MODE \n");
simu_mode=1;
} else if (strcmp("b",argv[i+1])==0) {
printf("Below IP: IPC/RPC MODE\n");
simu_mode=0;
}
}
else if ('T' == argv[i][1]) {
simu_time=atoi(argv[i+1]);
printf("simu_time=%d\n", simu_time);
}
else if ('d' == argv[i][1]) {
duration=atoi(argv[i+1]);
printf("duration node=%d\n", duration);
}
else if ('d' == argv[i][1]) {
duration=atoi(argv[i+1]);
printf("duration node=%d\n", duration);
}
else if ('s' == argv[i][1]) {
seed=atoi(argv[i+1]);
printf("seed val =%d\n", seed);
}
else if ('s' == argv[i][1]) {
seed=atoi(argv[i+1]);
printf("seed val =%d\n", seed);
}
else if ('P' == argv[i][1]) {
protocol=argv[i+1];
if ((strcmp(argv[i+1],"TCP")==0) || (strcmp(argv[i+1],"UDP")==0) || (strcmp(argv[i+1],"tcp")==0) || (strcmp(argv[i+1],"udp")==0))
{
protocol=argv[i+1];
printf("Protocol=%s\n", protocol);
}
}
else if ('P' == argv[i][1]) {
protocol=argv[i+1];
else if ('I' == argv[i][1]) {
if ((strcmp(argv[i+1],"IP4")==0) || (strcmp(argv[i+1],"IP6")==0) || (strcmp(argv[i+1],"ip4")==0) || (strcmp(argv[i+1],"ip6")==0))
{
ip_version=argv[i+1];
printf("IP version=%s\n", ip_version);
}
if ((strcmp(argv[i+1],"TCP")==0) || (strcmp(argv[i+1],"UDP")==0) || (strcmp(argv[i+1],"tcp")==0) || (strcmp(argv[i+1],"udp")==0)) {
protocol=argv[i+1];
printf("Protocol=%s\n", protocol);
}
}
else if ('I' == argv[i][1]) {
if ((strcmp(argv[i+1],"IP4")==0) || (strcmp(argv[i+1],"IP6")==0) || (strcmp(argv[i+1],"ip4")==0) || (strcmp(argv[i+1],"ip6")==0)) {
ip_version=argv[i+1];
printf("IP version=%s\n", ip_version);
}
}
}
else if ('A' == argv[i][1]) {
if ((strcmp(argv[i+1],"CBR")==0) || (strcmp(argv[i+1],"AUTO_PILOT")==0) || (strcmp(argv[i+1],"BICYCLE_RACE")==0) || (strcmp(argv[i+1],"OPENARENA")==0) || (strcmp(argv[i+1],"TEAM_FORTRESS")==0))
traffic=argv[i+1];
config_traffic_type(traffic);
else if ('A' == argv[i][1]) {
if ((strcmp(argv[i+1],"CBR")==0) || (strcmp(argv[i+1],"AUTO_PILOT")==0) || (strcmp(argv[i+1],"BICYCLE_RACE")==0) || (strcmp(argv[i+1],"OPENARENA")==0) || (strcmp(argv[i+1],"TEAM_FORTRESS")==0))
traffic=argv[i+1];
}
config_traffic_type(traffic);
}
}
}
}
if (traffic!=NULL)
init_predef_traffic();
else
init_config_otg(protocol, ip_version);
init_seeds(g_otg->seed);
cunstom_config(simu_time, duration);
}
if (simu_mode==0)
tx=main_below_ip();
if (traffic!=NULL)
init_predef_traffic();
else
init_config_otg(protocol, ip_version);
else if (simu_mode==1)
tx=main_above_ip();
init_seeds(g_otg->seed);
cunstom_config(simu_time, duration);
// Compute KPI after the end of the simu
kpi_gen();
if (simu_mode==0)
tx=main_below_ip();
free_otg();
else if (simu_mode==1)
tx=main_above_ip();
return 0;
// Compute KPI after the end of the simu
kpi_gen();
free_otg();
return 0;
}
@@ -470,7 +474,7 @@ n = uniform_dist(min, max);
if ((n<min) || (n>max))
printf("number=%d out of range \n", n);
else
else
{printf("gen_nb=%d \n", n);
// printf("ceil gen_nb=%lf \n", ceil(n));
}
+64 -44
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg.c
* \brief common function for otc tx and rx
* \brief common function for otc tx and rx
* \author N. Nikaein and A. Hafsaoui
* \date 2011
* \version 0.1
@@ -42,91 +42,108 @@
#include "otg.h"
#include "otg_vars.h"
// Defining initial and default values of OTG structures
void init_all_otg(int max_nb_frames) {
// Defining initial and default values of OTG structures
void init_all_otg(int max_nb_frames)
{
//set otg params to 0
g_otg = calloc(1, sizeof(otg_t));
if (g_otg == NULL)
/* Memory could not be allocated */
LOG_E(OTG,"Couldn't allocate memory for otg_t\n");
memset(g_otg, 0, sizeof(otg_t));
memset(g_otg, 0, sizeof(otg_t));
g_otg_multicast = calloc(1, sizeof(otg_multicast_t));
if (g_otg_multicast == NULL)
/* Memory could not be allocated */
LOG_E(OTG,"Couldn't allocate memory for otg_multicast_t\n");
memset(g_otg_multicast, 0, sizeof(otg_multicast_t));
//set otg infos to 0
otg_info = calloc(1, sizeof(otg_info_t));
if (otg_info == NULL)
/* Memory could not be allocated */
LOG_E(OTG,"Couldn't allocate memory for otg_info_t\n");
memset(otg_info, 0, sizeof(otg_info_t));
//set otg multicast infos to 0
otg_multicast_info = calloc(1, sizeof(otg_multicast_info_t));
if (otg_multicast_info == NULL)
/* Memory could not be allocated */
LOG_E(OTG,"Couldn't allocate memory for otg_multicast_info_t\n");
memset(otg_multicast_info, 0, sizeof(otg_multicast_info_t));
//set otg forms infos to 0
otg_forms_info=calloc(1, sizeof(otg_forms_info_t));
if (otg_forms_info == NULL)
/* Memory could not be allocated */
LOG_E(OTG,"Couldn't allocate memory for otg_forms_info_t\n");
memset(otg_forms_info, 0, sizeof(otg_forms_info_t));
g_otg->max_nb_frames=max_nb_frames;
LOG_I(OTG,"init done: init_all_otg\n");
}
char *str_sub (const char *s, unsigned int start, unsigned int end) {
char *str_sub (const char *s, unsigned int start, unsigned int end)
{
char *new_s = NULL;
int i;
if (s != NULL && start < end) {
new_s = malloc (sizeof (*new_s) * (end - start + 2));
if (new_s != NULL) {
for (i = start; i <= end; i++) {
new_s[i-start] = s[i];
new_s[i-start] = s[i];
}
new_s[i-start] = '\0';
} else {
LOG_E(OTG,"Insufficient memory \n");
exit (-1);
}
else {
LOG_E(OTG,"Insufficient memory \n");
exit (-1);
}
}
return new_s;
}
// set the simulation time
void set_ctime(int ctime){
void set_ctime(int ctime)
{
otg_info->ctime=ctime;
// otg_muticast_info->ctime=ctime;
// otg_muticast_info->ctime=ctime;
}
// get the simulation time
int get_ctime(void){
// get the simulation time
int get_ctime(void)
{
return otg_info->ctime;
}
void free_otg(){
int i,j,k;
void free_otg()
{
int i,j,k;
for (i=0; i<g_otg->num_nodes; i++)
for (j=0; j<g_otg->num_nodes; j++)
free( g_otg->dst_ip[i][j] );
@@ -135,23 +152,26 @@ void free_otg(){
g_otg = 0;
LOG_D(OTG,"DEBUG TARMA: free_otg() called \n");
for(i=0; i<NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++){
for(j=0; j<NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; j++){
for(k=0; k<MAX_NUM_APPLICATION; k++){
if(otg_info->tarma_stream[i][j][k]){
free(otg_info->tarma_stream[i][j][k]);
LOG_D(OTG,"DEBUG TARMA: freed tarma_stream[%d][%d][%d]\n",i,j,k);
}
if(otg_info->tarma_video[i][j][k]){
free(otg_info->tarma_video[i][j][k]);
LOG_D(OTG,"DEBUG TARMA: freed tarma_video[%d][%d][%d]\n",i,j,k);
}
if(otg_info->background_stream[i][j][k]){
free(otg_info->background_stream[i][j][k]);
LOG_D(OTG,"DEBUG TARMA: freed background_stream[%d][%d][%d]\n",i,j,k);
}
}
}
for(i=0; i<NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) {
for(j=0; j<NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; j++) {
for(k=0; k<MAX_NUM_APPLICATION; k++) {
if(otg_info->tarma_stream[i][j][k]) {
free(otg_info->tarma_stream[i][j][k]);
LOG_D(OTG,"DEBUG TARMA: freed tarma_stream[%d][%d][%d]\n",i,j,k);
}
if(otg_info->tarma_video[i][j][k]) {
free(otg_info->tarma_video[i][j][k]);
LOG_D(OTG,"DEBUG TARMA: freed tarma_video[%d][%d][%d]\n",i,j,k);
}
if(otg_info->background_stream[i][j][k]) {
free(otg_info->background_stream[i][j][k]);
LOG_D(OTG,"DEBUG TARMA: freed background_stream[%d][%d][%d]\n",i,j,k);
}
}
}
}
free(otg_info);
+23 -23
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg.h
* \brief Data structure and functions for OTG
* \brief Data structure and functions for OTG
* \author N. Nikaein and A. Hafsaoui
* \date 2011
* \version 1.0
@@ -40,7 +40,7 @@
#ifndef __OTG_H__
# define __OTG_H__
# define __OTG_H__
#include <stdio.h>
@@ -54,46 +54,46 @@
#if STANDALONE==1
#define LOG_G(c, x...) printf(x)
#define LOG_A(c, x...) printf(x)
#define LOG_C(c, x...) printf(x)
#define LOG_E(c, x...) printf(x)
#define LOG_W(c, x...) printf(x)
#define LOG_N(c, x...) printf(x)
#define LOG_I(c, x...) printf(x)
#define LOG_D(c, x...) printf(x)
#define LOG_F(c, x...) printf(x)
#define LOG_T(c, x...) printf(x)
typedef enum {MIN_NUM_COMPS=0, PHY, OMG, OCM, OTG, MAX_NUM_COMPS} comp_t;
#define LOG_G(c, x...) printf(x)
#define LOG_A(c, x...) printf(x)
#define LOG_C(c, x...) printf(x)
#define LOG_E(c, x...) printf(x)
#define LOG_W(c, x...) printf(x)
#define LOG_N(c, x...) printf(x)
#define LOG_I(c, x...) printf(x)
#define LOG_D(c, x...) printf(x)
#define LOG_F(c, x...) printf(x)
#define LOG_T(c, x...) printf(x)
typedef enum {MIN_NUM_COMPS=0, PHY, OMG, OCM, OTG, MAX_NUM_COMPS} comp_t;
#else
#include "../UTIL/LOG/log.h"
#endif
#include "../UTIL/LOG/log.h"
#endif
/*! \fn void init_all_otg(void)
* \brief set initial values de 0
* \brief set initial values de 0
* \param[in] void
* \param[out] void
* \note
* \note
* @ingroup _otg
*/
void init_all_otg(int max_nb_frames);
/*! \fn void set_ctime(int ctime)
* \brief set the simulation time to the ctime
* \brief set the simulation time to the ctime
* \param[in] simulation time , void
* \param[out] void
* \note
* \note
* @ingroup _otg
*/
void set_ctime(int ctime);
/*! \fn void get_ctime(void)
* \brief get the simulation time
* \brief get the simulation time
* \param[in] int
* \param[out] void
* \note
* \note
* @ingroup _otg
*/
int get_ctime(void);
@@ -102,9 +102,9 @@ int get_ctime(void);
/*! \fn void free_otg(void);
* \brief free OTG pointers
* \param[in]
* \param[in]
* \param[out]
* \note
* \note
* @ingroup _otg
*/
void free_otg(void);
+17 -17
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_config.h main used structures
* \brief otg structure
* \brief otg structure
* \author Navid Nikaein and A. Hafsaoui
* \date 2011 - 2014
* \version 0.1
@@ -40,7 +40,7 @@
*/
#ifndef __OTG_CONFIG_H__
# define __OTG_CONFIG_H__
# define __OTG_CONFIG_H__
/*!\brief It indicates that: the payload and the transport header (not otg header) are copied from static strings (HEADER_STRING and PAYLOAD_STRING) */
@@ -50,10 +50,10 @@
#define MAX_NUM_TRAFFIC_STATE 4 // we have 4 state: OFF, PU, ED, PE
/*!\brief Define the max number of application runing in the same time*/
#define MAX_NUM_APPLICATION 5
#define MAX_NUM_APPLICATION 5
/*!\brief Define the max number of service */
#define NUMBER_OF_SERVICE_MAX 2
#define NUMBER_OF_SERVICE_MAX 2
/*!\brief Define the max number of traffic runing in the same time - using their ID in the customized traffic*/
#define MAX_EMU_TRAFFIC 10
@@ -61,22 +61,22 @@
#define OTG_FLAG_SIZE 3
#define OTG_FLAG "OTG"
#define IDT_TH 100
#define IDT_TH 100
#define SIZE_COEF 1000
#define MAXIDT_TIME 1000000 //(1 second = 1000000 microseconds)
/*!\brief Define the max size of the TX buffer */
/*!\brief Define the max size of the TX buffer */
#define MAX_BUFF_TX 10000
/*!\brief Define the min size of the payload*/
/*!\brief Define the min size of the payload*/
#define PAYLOAD_MIN 1 /*46*/ //http://tools.ietf.org/html/rfc894
/*!\brief Define the min size of the payload, according to the Jumbo frame*/
/*!\brief Define the min size of the payload, according to the Jumbo frame*/
#ifdef JUMBO_FRAME
#define PAYLOAD_MAX 9000
#define PAYLOAD_MAX 9000
#else
#define PAYLOAD_MAX 1500 //http://tools.ietf.org/html/rfc894
#define PAYLOAD_MAX 1500 //http://tools.ietf.org/html/rfc894
#endif
@@ -95,16 +95,16 @@
#define RTP_HEADER 12
/*!\brief Define the max size of the header*/
#define MAX_HEADER_SIZE 80
#define MAX_HEADER_SIZE 80
/*!\brief Define the Alphabet string to generate the payload of the packet*/
#define ALPHABET_NUM_LETTER "abcdefghijklmnopqrstuvwyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789"
#define ALPHABET_NUM_LETTER "abcdefghijklmnopqrstuvwyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789"
#define ALPHABET_LETTER "abcdefghijklmnopqrstuvwyzABCDEFGHIGKLMNOPQRSTUVWXZ"
#define ALPHABET_LETTER "abcdefghijklmnopqrstuvwyzABCDEFGHIGKLMNOPQRSTUVWXZ"
/*!\brief Define the Alphabet string to generate the header of the packet*/
#define ALPHABET_NUM "0123456789"
#define ALPHABET_NUM "0123456789"
/*!\brief Define the static string to generate the header of the packet*/
//#define HEADER_STRING "5048717272261061594909177115977673656394812939088509638561159848103044447631759621785741859753883189"
@@ -125,7 +125,7 @@
#define MAX_ACCESS_DELAY 20
#define TERMINAL_ACCESS_DELAY 1
/*!\brief Latency budget for access domain(unit millisecond)*/
/*!\brief Latency budget for access domain(unit millisecond)*/
#define MIN_U_PLANE_GW_PROCESSING_DELAY 1
#define MAX_U_PLANE_GW_PROCESSING_DELAY 4
#define MIN_U_PLANE_CORE_IP_ACCESS_DELAY 1
@@ -133,7 +133,7 @@
#define MIN_FW_PROXY_DELAY 1
#define MAX_FW_PROXY_DELAY 2
/*!\brief Latency budget for core and application domain(unit millisecond)*/
/*!\brief Latency budget for core and application domain(unit millisecond)*/
#define MIN_NETWORK_ACCESS_DELAY 15
#define MAX_NETWORK_ACCESS_DELAY 150
#define MIN_SERVICE_ENABLERS_DELAY 300
+288 -287
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_defs.h main used structures
* \brief otg structure
* \brief otg structure
* \author N. Nikaein and A. Hafsaoui
* \date 2011
* \version 0.1
@@ -39,22 +39,22 @@
*/
#ifndef __OTG_DEFS_H__
# define __OTG_DEFS_H__
# define __OTG_DEFS_H__
#if STANDALONE==1
# define NUMBER_OF_eNB_MAX 3
# define NUMBER_OF_UE_MAX 3
# define NUMBER_OF_eNB_MAX 3
# define NUMBER_OF_UE_MAX 3
#else
#include "PHY/impl_defs_top.h" /* \brief To define the NUMBER_OF_eNB_MAX and NUMBER_OF_UE_MAX */
#endif
#include "PHY/impl_defs_top.h" /* \brief To define the NUMBER_OF_eNB_MAX and NUMBER_OF_UE_MAX */
#endif
#include "otg_config.h"
/**
* \enum Application
* \brief OTG applications type
*
* \brief OTG applications type
*
*
* Application describes the class of traffic supported and can be pre-configured bu otg_tx
*/
@@ -67,80 +67,80 @@ typedef enum {
MMVBR,
MBVBR,
MVIDEO_VBR_4MBPS
}Multicast_Application;
} Multicast_Application;
/**
* \enum Application
* \brief OTG applications type
*
* \brief OTG applications type
*
*
* Application describes the class of traffic supported and can be pre-configured bu otg_tx
*/
typedef enum {
NO_PREDEFINED_TRAFFIC =0,
M2M, // 1
SCBR, //2
MCBR, //3
BCBR, //4
AUTO_PILOT, //5
SCBR, //2
MCBR, //3
BCBR, //4
AUTO_PILOT, //5
BICYCLE_RACE, // 6
OPENARENA, // 7
TEAM_FORTRESS, // 8
FULL_BUFFER, // 9
M2M_TRAFFIC, // 10
AUTO_PILOT_L, //11 /*AUTO PILOT LOW SPEEDS*/
AUTO_PILOT_M, // 12 /*AUTO PILOT MEDIEUM SPEEDS*/
AUTO_PILOT_H, // 13 /*AUTO PILOT HIGH SPEEDS*/
AUTO_PILOT_E, // 14 /*AUTO PILOT EMERGENCY*/
VIRTUAL_GAME_L,// 15 /*VIRTUAL GAME LOW SPEEDS*/
VIRTUAL_GAME_M, // 16 /*VIRTUAL GAME MEDIEUM SPEEDS*/
VIRTUAL_GAME_H, // 17 /*VIRTUAL GAME HIGH SPEEDS*/
VIRTUAL_GAME_F, // 18 /*VIRTUAL GAME FINISH*/
ALARM_HUMIDITY, // 19 /* SENSOR BASED ALARM : HUMIDITY */
ALARM_SMOKE, // 20 /* SENSOR BASED ALARM : SMOKE */
M2M_TRAFFIC, // 10
AUTO_PILOT_L, //11 /*AUTO PILOT LOW SPEEDS*/
AUTO_PILOT_M, // 12 /*AUTO PILOT MEDIEUM SPEEDS*/
AUTO_PILOT_H, // 13 /*AUTO PILOT HIGH SPEEDS*/
AUTO_PILOT_E, // 14 /*AUTO PILOT EMERGENCY*/
VIRTUAL_GAME_L,// 15 /*VIRTUAL GAME LOW SPEEDS*/
VIRTUAL_GAME_M, // 16 /*VIRTUAL GAME MEDIEUM SPEEDS*/
VIRTUAL_GAME_H, // 17 /*VIRTUAL GAME HIGH SPEEDS*/
VIRTUAL_GAME_F, // 18 /*VIRTUAL GAME FINISH*/
ALARM_HUMIDITY, // 19 /* SENSOR BASED ALARM : HUMIDITY */
ALARM_SMOKE, // 20 /* SENSOR BASED ALARM : SMOKE */
ALARM_TEMPERATURE, // 21 /* SENSOR BASED ALARM : TEMPERATURE */
OPENARENA_DL, // 22
OPENARENA_UL, // 23
OPENARENA_DL, // 22
OPENARENA_UL, // 23
VOIP_G711, // 24
VOIP_G729, // 25
IQSIM_MANGO, // 26
VOIP_G729, // 25
IQSIM_MANGO, // 26
IQSIM_NEWSTEO, // 27
OPENARENA_DL_TARMA, // 28
VIDEO_VBR_10MBPS, // 29
VIDEO_VBR_4MBPS, // 30
VIDEO_VBR_2MBPS, // 31
VIDEO_VBR_768KBPS, // 32
VIDEO_VBR_384KBPS, // 33
VIDEO_VBR_192KBPS, // 34
VIDEO_VBR_2MBPS, // 31
VIDEO_VBR_768KBPS, // 32
VIDEO_VBR_384KBPS, // 33
VIDEO_VBR_192KBPS, // 34
BACKGROUND_USERS, // 35
DUMMY
}Application;
} Application;
/**
* \enum dist_type
* \brief OTG implemented distribution for packet and inter departure time computation
*
*
*
* dist_type presents the used distribition to generate inter departure time and packet size
*/
typedef enum {
NO_TRAFFIC=0,
UNIFORM, //1
GAUSSIAN, //2
EXPONENTIAL, //3
POISSON, // 4
FIXED, // 5
WEIBULL, // 6
PARETO, // 7
GAMMA, // 8
CAUCHY, // 9
LOG_NORMAL, // 10
TARMA,
VIDEO,
BACKGROUND_DIST,
}dist_type;
typedef enum {
NO_TRAFFIC=0,
UNIFORM, //1
GAUSSIAN, //2
EXPONENTIAL, //3
POISSON, // 4
FIXED, // 5
WEIBULL, // 6
PARETO, // 7
GAMMA, // 8
CAUCHY, // 9
LOG_NORMAL, // 10
TARMA,
VIDEO,
BACKGROUND_DIST,
} dist_type;
/**
@@ -151,104 +151,104 @@ typedef enum {
*
*/
typedef enum {
NO_PROTO=0,
UDP=1,
TCP,
}trans_proto;
typedef enum {
NO_PROTO=0,
UDP=1,
TCP,
} trans_proto;
/**
* \enum ip_v
*
*\brief ip_v presents the used IP version to generate the packet
*\brief ip_v presents the used IP version to generate the packet
*
*/
typedef enum {
NO_IP=0,
IPV4=1,
IPV6,
}ip_v;
typedef enum {
NO_IP=0,
IPV4=1,
IPV6,
} ip_v;
/**
* \enum ip_v
*
*\brief ip_v presents the used IP version to generate the packet
*\brief ip_v presents the used IP version to generate the packet
*
*/
/*
typedef enum {
OFF_STATE=0,
typedef enum {
OFF_STATE=0,
ON_STATE,
ACTIVE_STATE,
MAX_NUM_STATE,
ACTIVE_STATE,
MAX_NUM_STATE,
}TRAFFIC_STATE;
*/
typedef enum {
OFF_STATE=0,
PU_STATE,
ED_STATE,
PE_STATE,
}TRAFFIC_STATE;
typedef enum {
OFF_STATE=0,
PU_STATE,
ED_STATE,
PE_STATE,
} TRAFFIC_STATE;
typedef enum {
SILENCE=0,
SIMPLE_TALK=3,
}VOIP_STATE;
typedef enum {
SILENCE=0,
SIMPLE_TALK=3,
} VOIP_STATE;
/**
* \enum ALPHABET
*
*\brief ALPHABET Alphabet type to generate random string
*\brief ALPHABET Alphabet type to generate random string
*
*/
typedef enum {
REPEAT_STRING=0, // repeat the same set of characters
SUBSTRACT_STRING, // substract the string from the know character string
typedef enum {
REPEAT_STRING=0, // repeat the same set of characters
SUBSTRACT_STRING, // substract the string from the know character string
RANDOM_POSITION, // take the char from the known character string randomly
RANDOM_STRING, // rake the charcters randomly
}ALPHABET_GEN;
typedef enum {
RANDOM_STRING, // rake the charcters randomly
} ALPHABET_GEN;
typedef enum {
HEADER_ALPHABET=0,
PAYLOAD_ALPHABET,
}ALPHABET_TYPE;
PAYLOAD_ALPHABET,
} ALPHABET_TYPE;
/**
* \enum HEADER_TYPE
*
* \brief HEADER_TYPE alows to identify the transport protocol and IP version
* \brief HEADER_TYPE alows to identify the transport protocol and IP version
*
*/
typedef enum {
NO_HEADER=0,
UDP_IPV4,
TCP_IPV4,
UDP_IPV6,
TCP_IPV6,
}HEADER_TYPE;
typedef enum {
NO_HEADER=0,
UDP_IPV4,
TCP_IPV4,
UDP_IPV6,
TCP_IPV6,
} HEADER_TYPE;
/**
* \enum TRAFFIC_TYPE
*
* \brief HEADER_TYPE alows to identify the traffic type no specific type, m2m,etc.
* \brief HEADER_TYPE alows to identify the traffic type no specific type, m2m,etc.
*
*/
/*
typedef enum {
typedef enum {
NO_TYPE=0,
M2M_TYPE,
}TRAFFIC_TYPE;
*/
/*
otg_models: definitions and structures,
see otg_models.c for a detailed description
/*
otg_models: definitions and structures,
see otg_models.c for a detailed description
*/
/*tarma*/
@@ -264,29 +264,30 @@ M2M_TYPE,
#define BACKGROUND_RATE_MAX 1e6/8 /*maximum mean rate for bg-traffic (B/s))*/
/*tarma*/
typedef struct { /* this struct inherits all the necessary information for cunstructing
the next random sample of one random process -
- the xml parser must instanciate such a struct for each <Process> environment
within the <RandomProcesses> environment*/
double inputWeight [TARMA_NUM_PROCESSES]; /* weights for summation of different gaussian input processes
- default: 0 */
typedef struct {
/* this struct inherits all the necessary information for cunstructing
the next random sample of one random process -
- the xml parser must instanciate such a struct for each <Process> environment
within the <RandomProcesses> environment*/
double inputWeight [TARMA_NUM_PROCESSES]; /* weights for summation of different gaussian input processes
- default: 0 */
double maWeight [TARMA_NUM_MA_MAX]; /* weigths of the MA (FIR) filter -
- <MaCoeff><Lag>0</Lag><Weight> 0.3</Weight></MaCoeff> goes here -
- the xml parser must place the value of <Weight> at the index of <Lag> -
- default: 0*/
double maHist [TARMA_NUM_MA_MAX]; /* the MA history, updated by the CalculateSample() function,
- default: 0 */
- <MaCoeff><Lag>0</Lag><Weight> 0.3</Weight></MaCoeff> goes here -
- the xml parser must place the value of <Weight> at the index of <Lag> -
- default: 0*/
double maHist [TARMA_NUM_MA_MAX]; /* the MA history, updated by the CalculateSample() function,
- default: 0 */
double arWeight [TARMA_NUM_AR_MAX]; /* weigths of the AR (IIR) filter -
- <ArCoeff><Lag>0</Lag><Weight> 0.3</Weight></ArCoeff> goes here -
- the xml parser must place the value of <Weight> at the index of <Lag> -
- default: 0*/
double arHist [TARMA_NUM_AR_MAX]; /* the AR history, updated by the CalculateSample() function,
- default: 0 */
- <ArCoeff><Lag>0</Lag><Weight> 0.3</Weight></ArCoeff> goes here -
- the xml parser must place the value of <Weight> at the index of <Lag> -
- default: 0*/
double arHist [TARMA_NUM_AR_MAX]; /* the AR history, updated by the CalculateSample() function,
- default: 0 */
double polyWeight [TARMA_NUM_POLY_MAX]; /* weights of the polynomial transformation -
- <PolyCoeff><Power>0</Power><Weight> 123</Weight></PolyCoeff> goes here -
- the xml parser must place the value of <Weigth> at the index of <Power> -
- default: 0*/
}tarmaProcess_t;
- <PolyCoeff><Power>0</Power><Weight> 123</Weight></PolyCoeff> goes here -
- the xml parser must place the value of <Weigth> at the index of <Power> -
- default: 0*/
} tarmaProcess_t;
typedef struct { /*this struct inherits processes and input samples for one flow*/
// processes for packet size and packet inter arrival time
@@ -294,47 +295,47 @@ typedef struct { /*this struct inherits processes and input samples for one flow
tarmaProcess_t tarma_size;
// input samples used for both, packet size and packet inter-arrival time
double tarma_input_samples [TARMA_NUM_PROCESSES];
}tarmaStream_t;
} tarmaStream_t;
typedef struct { /*this struct inherits processes and input samples for a video sequence*/
tarmaProcess_t tarma_size;
int tarmaVideoFrameNumber;
int tarmaVideoGopStructure[TARMA_NUM_GOP_MAX];
double polyWeightFrame [TARMA_NUM_FRAME_TYPES][TARMA_NUM_POLY_MAX];
}tarmaVideo_t;
} tarmaVideo_t;
/*background*/
typedef struct { /*this struct constitutes a single bg-session*/
double meanSessionRate;
int endTime;
}backgroundSession_t;
} backgroundSession_t;
typedef struct { /*this structure constitutes a whole bg-stream with multiple bg-sessions*/
double meanNumSessions; /*equivalent to lambda_n*/
int lastUpdateTime;
backgroundSession_t activeSessions[BACKGROUND_NUM_ACTIVE_MAX];
}backgroundStream_t;
} backgroundStream_t;
typedef struct {
int application_type[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/
int trans_proto[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
int ip_v[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
int flow_start[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Duration of traffic generation or use the emuulation time instead */
int flow_duration[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Duration of traffic generation or use the emuulation time instead */
int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Inter Departure Time distribution */
int idt_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Min Inter Departure Time, for uniform distrib */
int idt_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */
int size_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Paylolad size distribution */
int size_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Min Payload size, for uniform distrib */
int size_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief payload, Max Inter Departure Time, for uniform distrib */
}otg_multicast_t;
int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Inter Departure Time distribution */
int idt_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Min Inter Departure Time, for uniform distrib */
int idt_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */
int size_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Paylolad size distribution */
int size_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief Min Payload size, for uniform distrib */
int size_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION]; /*!\brief payload, Max Inter Departure Time, for uniform distrib */
} otg_multicast_t;
/**
@@ -345,41 +346,41 @@ typedef struct {
*/
typedef struct {
int max_nb_frames; /*!< \brief Max Number of frames*/
int application_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/
int application_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief It identify the application of the simulated traffic, could be cbr, m2m, gaming,etc*/
/*!\header info */
int trans_proto[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Transport Protocol*/
int ip_v[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Ip version */
//int header_compression; /*!\brief Specify if header compression is used or not */
int num_nodes; /*!\brief Number of used nodes in the simulation */
int packet_gen_type; /*!\brief define how the payload is generated: fixed, predefined, random position, random see ALPHABET_GEN */
int trans_proto[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Transport Protocol*/
int ip_v[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief Ip version */
//int header_compression; /*!\brief Specify if header compression is used or not */
int num_nodes; /*!\brief Number of used nodes in the simulation */
int packet_gen_type; /*!\brief define how the payload is generated: fixed, predefined, random position, random see ALPHABET_GEN */
unsigned int background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief enable or disable background traffic */
unsigned int aggregation_level[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /* define packet aggregation level for the case of gateway*/
// src id , dst id, and state // think to the case of several streams per node !!!!!
int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Inter Departure Time distribution */
int idt_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Inter Departure Time, for uniform distrib */
int idt_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */
// src id , dst id, and state // think to the case of several streams per node !!!!!
int idt_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Inter Departure Time distribution */
int idt_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Inter Departure Time, for uniform distrib */
int idt_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Max Inter Departure Time, for uniform distrib */
double idt_std_dev[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Standard Deviation, for guassian distrib */
double idt_std_dev[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, Standard Deviation, for guassian distrib */
double idt_lambda[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief idt, lambda, for exponential/poisson distrib */
double idt_scale[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/
double idt_shape[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/
double idt_scale[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/
double idt_shape[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/
int size_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Paylolad size distribution */
int size_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Payload size, for uniform distrib */
int size_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Max Inter Departure Time, for uniform distrib */
double size_std_dev[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Standard Deviation, for guassian distrib */
int size_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Paylolad size distribution */
int size_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief Min Payload size, for uniform distrib */
int size_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Max Inter Departure Time, for uniform distrib */
double size_std_dev[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, Standard Deviation, for guassian distrib */
double size_lambda[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief payload, lambda, for exponential/poisson distrib */
double size_scale[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution */
double size_shape[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/
double size_scale[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief scale :parameter for Pareto, Gamma, Weibull and Cauchy distribution */
double size_shape[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION][MAX_NUM_TRAFFIC_STATE]; /*!\brief shape :parameter for Pareto, Gamma, Weibull and Cauchy distribution*/
// info for state-based traffic gen
int num_state [NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!\brief Number of states for source node*/
// int state_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_TRAFFIC_STATE]; /*!\brief States distribution */
// int state_dist[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_TRAFFIC_STATE]; /*!\brief States distribution */
double state_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_TRAFFIC_STATE]; /*!\brief State probablity: prob to move from one state to the other one */
// num stream for each src
// int stream [NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; // this requires multi thread for parallel stream for a givcen src
// int stream [NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; // this requires multi thread for parallel stream for a givcen src
// emu info
int flow_start_flag[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief flow start time flag for traffic generation or use the emuulation time instead */
int flow_start[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!\brief flow start time of traffic generation or use the emuulation time instead */
@@ -403,7 +404,7 @@ typedef struct {
double prob_ed_pu[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int holding_time_off_ed[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int holding_time_off_pu[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int holding_time_off_pe[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int holding_time_off_pe[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int holding_time_pe_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int pu_size_pkts[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int ed_size_pkts[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
@@ -411,7 +412,7 @@ typedef struct {
unsigned int throughput_metric;
unsigned int latency_metric;
unsigned int latency_metric;
unsigned int loss_metric;
unsigned int curve;
unsigned int owd_radio_access;
@@ -419,28 +420,28 @@ typedef struct {
unsigned int application_idx[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
}otg_t;
} otg_t;
typedef struct{
typedef struct {
unsigned char flow_id; /*!< \brief It identify the flow ID (we can have source and destination with several flows) */
unsigned int time; /*!< \brief simulation time at the tx, this is ctime */
unsigned int seq_num; /*!< \brief Sequence Number, counter of data packets between tx and rx */
unsigned char state; /*!< \brief state of node : on, off, or active */
unsigned char hdr_type; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
unsigned short pkts_size; /*!< \brief the size of payload + header */
unsigned short aggregation_level; /*!< \brief packet aggregation level */
unsigned int traffic_type; /*!< \brief to specify if it corresponds to an m2m traffic */
//int payload_size; /*!< \brief the size of the payload to transmit */
//int header_size; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
}__attribute__((__packed__)) otg_hdr_t;
unsigned char flow_id; /*!< \brief It identify the flow ID (we can have source and destination with several flows) */
unsigned int time; /*!< \brief simulation time at the tx, this is ctime */
unsigned int seq_num; /*!< \brief Sequence Number, counter of data packets between tx and rx */
unsigned char state; /*!< \brief state of node : on, off, or active */
unsigned char hdr_type; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
unsigned short pkts_size; /*!< \brief the size of payload + header */
unsigned short aggregation_level; /*!< \brief packet aggregation level */
unsigned int traffic_type; /*!< \brief to specify if it corresponds to an m2m traffic */
//int payload_size; /*!< \brief the size of the payload to transmit */
//int header_size; /*!< \brief Header type: tcp/udp vs ipv4/ipv6 */
} __attribute__((__packed__)) otg_hdr_t;
typedef struct {
unsigned int flag;
unsigned int size;
} __attribute__((__packed__)) otg_hdr_info_t;
typedef struct{
unsigned int flag;
unsigned int size;
}__attribute__((__packed__)) otg_hdr_info_t;
/**
* \struct packet_t
@@ -451,49 +452,49 @@ typedef struct{
*/
typedef struct{
char* header ; /*!< \brief Header */
char* payload; /*!< \brief Payload*/
}__attribute__((__packed__)) packet_t;
typedef struct {
char* header ; /*!< \brief Header */
char* payload; /*!< \brief Payload*/
} __attribute__((__packed__)) packet_t;
typedef struct {
int ctime;
int ptime[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size_otg[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size_app[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int ctime;
int ptime[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size_otg[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size_app[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int idt[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int tx_sn[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int rx_sn[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int tx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int tx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int rx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int rx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
float rx_owd_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_owd_min[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
int rx_pkt_owd[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX];
int loss_pkts_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
int loss_rate[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][MAX_NUM_APPLICATION];
float radio_access_delay[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX];
double tx_throughput[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX];
double rx_goodput[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX]; /*!< \brief Rx goodput: (size of received data)/ctime*/
float rx_loss_rate[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/
double rx_goodput[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX]; /*!< \brief Rx goodput: (size of received data)/ctime*/
float rx_loss_rate[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/
unsigned int rx_total_bytes_dl;
/*TARMA parameteres*/
tarmaStream_t *mtarma_stream[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
tarmaVideo_t *mtarma_video[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
}otg_multicast_info_t;
} otg_multicast_info_t;
@@ -505,73 +506,73 @@ typedef struct {
*
*/
typedef struct{
/*!< \brief info part: */
int ctime; /*!< \brief Simulation time in ms*/
int ptime_background_ul; /*!< \brief time of last sent background UL data (time in ms)*/
int ptime_background_dl; /*!< \brief time of last sent background DL data (time in ms)*/
int ptime[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief time of last sent data (time in ms)*/
int seq_num[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the sender */
typedef struct {
/*!< \brief info part: */
int ctime; /*!< \brief Simulation time in ms*/
int ptime_background_ul; /*!< \brief time of last sent background UL data (time in ms)*/
int ptime_background_dl; /*!< \brief time of last sent background DL data (time in ms)*/
int ptime[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief time of last sent data (time in ms)*/
int seq_num[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the sender */
int seq_num_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief the sequence number for background traffic of the sender */
int seq_num_rx[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the receiver */
int seq_num_rx_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief the sequence number for background traffic of the receiver */
int seq_num_rx[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief the sequence number of the receiver */
int seq_num_rx_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief the sequence number for background traffic of the receiver */
int idt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Inter Departure Time for background traffic in ms*/
int size_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief payload size for background traffic*/
int idt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief Inter Departure Time in ms*/
int header_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Define the type of header: Transport layer + IP version*/
int idt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief Inter Departure Time in ms*/
int header_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Define the type of header: Transport layer + IP version*/
/*!< \brief Statics part: vars updated at each iteration of otg_tx */
int tx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the tx*/
int tx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the tx*/ // get the size and calculate the avg throughput
// vars updated at each iteration of otg_rx
int rx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the rx */
int rx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the rx */
float rx_pkt_owd[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime, */
float rx_owd_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_owd_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime, */
float rx_owd_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_owd_history[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_owd_history_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_jitter[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */
float rx_jitter_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_jitter_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_jitter_avg[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_jitter_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */
float rx_jitter_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_jitter_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_jitter_avg_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
int rx_jitter_sample[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
int nb_loss_pkts_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for UL*/
int nb_loss_pkts_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for DL*/
float owd_const[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief One way delay constant*/
/*!< \brief KPI part: calculate the KPIs, total */
double tx_throughput[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/
double rx_goodput[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Rx goodput: (size of received data)/ctime*/
float rx_loss_rate[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/
//int rx_latency[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx Latency */
int tx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the tx*/
int tx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the tx*/ // get the size and calculate the avg throughput
// vars updated at each iteration of otg_rx
int rx_num_pkt[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packet in the rx */
int rx_num_bytes[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of bytes in the rx */
float rx_pkt_owd[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime, */
float rx_owd_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_owd_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime, */
float rx_owd_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_owd_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_owd_history[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_owd_history_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][2]; /*!< \brief One way delay histoy used for jitter calculation: rx_ctime - tx_ctime, [2] to keep the owd for the current and previous pkt */
float rx_pkt_jitter[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */
float rx_jitter_min[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_jitter_max[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_jitter_avg[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_pkt_jitter_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief One way delay: rx_ctime - tx_ctime */
float rx_jitter_min_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay min*/
float rx_jitter_max_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
float rx_jitter_avg_e2e[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
int rx_jitter_sample[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief One way delay max*/
int nb_loss_pkts_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for UL*/
int nb_loss_pkts_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Number of data packets losses for DL*/
float owd_const[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief One way delay constant*/
/*!< \brief KPI part: calculate the KPIs, total */
double tx_throughput[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/
double rx_goodput[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Rx goodput: (size of received data)/ctime*/
float rx_loss_rate[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_EMU_TRAFFIC]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/
//int rx_latency[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx Latency */
/*!< \brief Background traffic part: SATS + KPIs */
int tx_num_pkt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background data packet in the rx */
int tx_num_bytes_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background bytes in the rx */
int rx_num_pkt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background data packet in the tx */
int rx_num_bytes_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background bytes in the tx */
int tx_num_pkt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background data packet in the rx */
int tx_num_bytes_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background bytes in the rx */
int rx_num_pkt_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background data packet in the tx */
int rx_num_bytes_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background bytes in the tx */
int nb_loss_pkts_background_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background packets losses for UL*/
int nb_loss_pkts_background_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Number of background packets losses for DL*/
double tx_throughput_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/
double rx_goodput_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx goodput: (size of received data)/ctime*/
float rx_loss_rate_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/
double tx_throughput_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Tx throughput: (size of transmitted data)/ctime*/
double rx_goodput_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx goodput: (size of received data)/ctime*/
float rx_loss_rate_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX]; /*!< \brief Rx Loss Rate: ratio, unit: bytes*/
float radio_access_delay[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
float radio_access_delay[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
int nb_loss_pkts_otg[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int aggregation_level[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int state[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief current state of src node */
float state_transition_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_holding_time_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int state[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; /*!< \brief current state of src node */
float state_transition_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_holding_time_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int c_holding_time_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int c_holding_time_pe_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_holding_time_pe_off[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
@@ -585,16 +586,16 @@ typedef struct{
float average_jitter_ul;
float average_jitter_dl_e2e;
float average_jitter_ul_e2e;
/* VOIP tarffic parameters*/
float voip_transition_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int voip_state[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_voip_silence[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int c_holding_time_silence[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_voip_talk[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int c_holding_time_talk[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int silence_time[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int simple_talk_time[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
float voip_transition_prob[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int voip_state[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_voip_silence[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int c_holding_time_silence[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int start_voip_talk[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int c_holding_time_talk[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int silence_time[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int simple_talk_time[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
/*TARMA parameteres*/
tarmaStream_t *tarma_stream[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
@@ -602,58 +603,58 @@ typedef struct{
/*BACKGROUND_USERS parameters*/
backgroundStream_t *background_stream[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size_app[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int header_size_app[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION];
unsigned int header_size[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int m2m_aggregation[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int flow_id[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int traffic_type[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int traffic_type_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int traffic_type_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
// unsigned int traffic_type_multicast[NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_SERVICE_MAX];
unsigned int hdr_size[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
unsigned int header_type_app[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_NUM_APPLICATION]; ;
unsigned int gen_pkts;
unsigned int header_size_background[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
}otg_info_t;
} otg_info_t;
//char buffer_tx[MAX_BUFF_TX]; /*!< \brief define the buffer for the data to transmit */
typedef struct{
// char *src_ip; /*!< \brief */
int src:16; /*!< \brief */
int dst:16; /*!< \brief */
int trans_proto:16; /*!< \brief */
int ip_v:16; /*!< \brief */
// int payload_size:16;
}__attribute__((__packed__)) control_hdr_t;
typedef struct {
// char *src_ip; /*!< \brief */
int src:16; /*!< \brief */
int dst:16; /*!< \brief */
int trans_proto:16; /*!< \brief */
int ip_v:16; /*!< \brief */
// int payload_size:16;
} __attribute__((__packed__)) control_hdr_t;
typedef struct{
control_hdr_t* control_hdr; /*!< \brief */
char* payload_rest; /*!< \brief */
}__attribute__((__packed__)) payload_t;
typedef struct {
control_hdr_t* control_hdr; /*!< \brief */
char* payload_rest; /*!< \brief */
} __attribute__((__packed__)) payload_t;
#define MAX_SAMPLES 30
typedef struct{
int init_forms;
int is_data_plot_ul;
int is_data_plot_dl;
float data_owd_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_throughput_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_ctime_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
int idx_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
float data_owd_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_throughput_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_ctime_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
int idx_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
}otg_forms_info_t;
typedef struct {
int init_forms;
int is_data_plot_ul;
int is_data_plot_dl;
float data_owd_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_throughput_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_ctime_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
int idx_ul[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
float data_owd_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_throughput_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
float data_ctime_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][MAX_SAMPLES];
int idx_dl[NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX];
} otg_forms_info_t;
#endif
+1 -1
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_externs.h
* \brief extern parameters
* \brief extern parameters
* \author n. nikaein A. Hafsaoui
* \date 2012
* \version 1.0
+221 -216
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_config.h main used structures
* \brief otg structure
* \brief otg structure
* \author A. Hafsaoui and Navid Nikaein
* \date 2011
* \version 0.1
@@ -59,203 +59,208 @@ FD_otg *create_form_otg(void)
fdui->otg = fl_bgn_form(FL_NO_BOX, 550, 550);
obj = fl_add_box(FL_UP_BOX,0,0,900,700,"");
fdui->owd = fl_add_xyplot(FL_NORMAL_XYPLOT,50,30,450,190,"Delay(ms)");
fdui->owd = fl_add_xyplot(FL_NORMAL_XYPLOT,50,30,450,190,"Delay(ms)");
fl_set_object_color(fdui->owd,FL_BLACK,FL_YELLOW);
fdui->throughput = fl_add_xyplot(FL_NORMAL_XYPLOT,50,300,450,190,"Throughput(Kbit/s)");
fl_set_object_color(fdui->throughput,FL_BLACK,FL_YELLOW);
obj = fl_add_button(FL_NORMAL_BUTTON,250,510,50,30,"Exit");
fl_set_object_callback(obj, exit_cb, 0);
fdui->loss_ratio=fl_add_text(FL_NORMAL_TEXT,5,510,220,20,"NB Loss pkts");
fdui->simu_time=fl_add_text(FL_NORMAL_TEXT,370,510,250,30,"Simulation Time");
obj = fl_add_button(FL_NORMAL_BUTTON,250,510,50,30,"Exit");
fl_set_object_callback(obj, exit_cb, 0);
fdui->loss_ratio=fl_add_text(FL_NORMAL_TEXT,5,510,220,20,"NB Loss pkts");
fdui->simu_time=fl_add_text(FL_NORMAL_TEXT,370,510,250,30,"Simulation Time");
fl_end_form();
fdui->otg->fdui = fdui;
return fdui;
return fdui;
}
//For more details about object parameters, refer to: http://xforms-toolkit.org/doc/xforms_25.html
void show_otg_form() {
void show_otg_form()
{
int eNB_id;
char title[255];
char *tArgv[] = { "OTG", "OTG" };
int tArgc = 2;
int major_owd = 6;
int minor_owd = 3;
int minor_owd = 3;
int major_thr = 5;
int minor_thr = 2;
int minor_thr = 2;
fl_initialize(&tArgc,tArgv,"OTG",0,0);
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) { //NB_eNB_INST
form_dl= create_form_otg ();
sprintf (title, "LTE eNB->UE (DL)");
fl_show_form (form_dl->otg, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
fl_set_form_position(form_dl->otg, 200, 200);
fl_set_xyplot_ytics(form_dl->owd,major_owd, minor_owd);
if (g_otg->owd_radio_access==1)
fl_set_xyplot_ybounds(form_dl->owd,0,200);
else
fl_set_xyplot_ybounds(form_dl->owd,0,400);
fl_set_xyplot_ytics(form_dl->throughput,major_thr, minor_thr);
fl_set_xyplot_ybounds(form_dl->throughput,0,1000);
fl_set_xyplot_ybounds(form_dl->throughput,0,1000);
form_ul= create_form_otg ();
sprintf (title, "LTE UE->eNB (UL)");
fl_show_form (form_ul->otg, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
fl_set_form_position(form_ul->otg, 850, 200);
fl_set_xyplot_ytics(form_ul->owd,major_owd, minor_owd);
if (g_otg->owd_radio_access==1)
fl_set_xyplot_ybounds(form_ul->owd,0,200);
else
fl_set_xyplot_ybounds(form_ul->owd,0,400);
//fl_set_positioner_ystep (form_ul->throughput, 100);
//fl_set_xyplot_xgrid (form_ul->throughput, FL_GRID_MAJOR);
fl_set_xyplot_ytics(form_ul->throughput,major_thr, minor_thr);
fl_set_xyplot_ybounds(form_ul->throughput,0,1000);
fl_set_xyplot_ybounds(form_ul->throughput,0,1000);
}
//create_form_clock();
//fl_show_form(fclock, FL_PLACE_CENTER,FL_TRANSIENT,"clocks");
//fl_do_forms();
//create_form_clock();
//fl_show_form(fclock, FL_PLACE_CENTER,FL_TRANSIENT,"clocks");
//fl_do_forms();
fl_check_forms();
}
void add_tab_metric(int src, int dst, float owd, float throughput, int ctime){
}
if (otg_forms_info->init_forms==0){
void add_tab_metric(int src, int dst, float owd, float throughput, int ctime)
{
if (otg_forms_info->init_forms==0) {
show_otg_form();
otg_forms_info->init_forms=1;
otg_forms_info->is_data_plot_ul=-1;
otg_forms_info->is_data_plot_ul=-1;
otg_forms_info->is_data_plot_dl=-1;
}
if (dst<NB_eNB_INST){
if (dst<NB_eNB_INST) {
//LOG_D(OTG,"direction: UL [src:%d, dst:%d] \n", src, dst);
otg_forms_info->data_owd_ul[src][dst][otg_forms_info->idx_ul[src][dst]]= owd;
otg_forms_info->data_throughput_ul[src][dst][otg_forms_info->idx_ul[src][dst]]=throughput;
otg_forms_info->data_ctime_ul[src][dst][otg_forms_info->idx_ul[src][dst]]= otg_forms_info->idx_ul[src][dst];
otg_forms_info->data_ctime_ul[src][dst][otg_forms_info->idx_ul[src][dst]]= otg_forms_info->idx_ul[src][dst];
otg_forms_info->idx_ul[src][dst]++;
plot_graphes_ul(src, dst, ctime);
}
else{
} else {
//LOG_D(OTG,"direction: DL [src:%d, dst:%d] \n", src, dst);
otg_forms_info->data_owd_dl[src][dst][otg_forms_info->idx_dl[src][dst]]= owd;
otg_forms_info->data_throughput_dl[src][dst][otg_forms_info->idx_dl[src][dst]]= throughput;
otg_forms_info->data_ctime_dl[src][dst][otg_forms_info->idx_dl[src][dst]]= otg_forms_info->idx_dl[src][dst];
otg_forms_info->data_ctime_dl[src][dst][otg_forms_info->idx_dl[src][dst]]= otg_forms_info->idx_dl[src][dst];
otg_forms_info->idx_dl[src][dst]++;
plot_graphes_dl(src, dst, ctime);
}
//LOG_D(OTG,"OTG_forms[src %d, dst %d] owd %f TH %f \n", src, dst, owd, throughput);
//LOG_D(OTG,"MAX_UE_eNB %d, %d \n:", NB_UE_INST, NB_eNB_INST);
//LOG_D(OTG,"OTG_forms[src %d, dst %d] owd %f TH %f \n", src, dst, owd, throughput);
//LOG_D(OTG,"MAX_UE_eNB %d, %d \n:", NB_UE_INST, NB_eNB_INST);
}
void plot_graphes_ul(int src, int dst, int ctime) //UE -->eNB
{
int i, src_idx=1, curve_id=1;
char loss_rate[100];
char simu_time[100];
char curve_label[100];
int x_key_position=27;
int y_key_position=75;
int i, src_idx=1, curve_id=1;
char loss_rate[100];
char simu_time[100];
char curve_label[100];
int x_key_position=27;
int y_key_position=75;
if (otg_forms_info->idx_ul[src][dst]==MAX_SAMPLES-1){
if (otg_forms_info->idx_ul[src][dst]==MAX_SAMPLES-1) {
fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server
fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server
if (otg_forms_info->is_data_plot_ul == -1)
otg_forms_info->is_data_plot_ul=src;
if (otg_forms_info->is_data_plot_ul == src) {
fl_set_xyplot_data (form_ul->owd, otg_forms_info->data_ctime_ul[src][dst],
otg_forms_info->data_owd_ul[src][dst], otg_forms_info->idx_ul[src][dst], "", "time", "ms");
sprintf(curve_label, "%d%s%d", src,"-->", dst);
fl_set_xyplot_key(form_ul->owd, 0, curve_label);
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_ul->throughput, otg_forms_info->data_ctime_ul[src][dst],
otg_forms_info->data_throughput_ul[src][dst], otg_forms_info->idx_ul[src][dst], "", "time", "kbit/s");
fl_set_xyplot_key(form_ul->throughput, 0, curve_label);
fl_set_xyplot_key_font(form_ul->throughput, FL_BOLD_STYLE, FL_HUGE_SIZE);
fl_set_xyplot_key_position(form_ul->throughput, x_key_position,y_key_position , FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts UL=", otg_info->total_loss_ul);
fl_set_object_label(form_ul->loss_ratio, loss_rate);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_ul->simu_time, simu_time);
}
else {
fl_set_xyplot_data (form_ul->owd, otg_forms_info->data_ctime_ul[otg_forms_info->is_data_plot_ul][dst],
otg_forms_info->data_owd_ul[otg_forms_info->is_data_plot_ul][dst], otg_forms_info->idx_ul[otg_forms_info->is_data_plot_ul][dst], "", "time", "ms");
sprintf(curve_label, "%d%s%d", otg_forms_info->is_data_plot_ul,"-->", dst);
fl_set_xyplot_key(form_ul->owd, 0, curve_label);
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_ul->throughput, otg_forms_info->data_ctime_ul[otg_forms_info->is_data_plot_ul][dst],
otg_forms_info->data_throughput_ul[otg_forms_info->is_data_plot_ul][dst], otg_forms_info->idx_ul[otg_forms_info->is_data_plot_ul][dst], "", "time", "kbit/s");
sprintf(curve_label, "%d%s%d", otg_forms_info->is_data_plot_ul,"-->", dst);
fl_set_xyplot_key(form_ul->throughput, 0, curve_label);
fl_set_xyplot_key_position(form_ul->throughput, x_key_position,y_key_position , FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts UL=",otg_info->total_loss_ul);
fl_set_object_label(form_ul->loss_ratio, loss_rate);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_ul->simu_time, simu_time);
}
for (src_idx=1;src_idx<=NB_UE_INST;src_idx++){
if (src_idx!=otg_forms_info->is_data_plot_ul){
fl_add_xyplot_overlay(form_ul->owd,curve_id++,
otg_forms_info->data_ctime_ul[src_idx][dst],
otg_forms_info->data_owd_ul[src_idx][dst],
otg_forms_info->idx_ul[src_idx][dst],src_idx+6);
sprintf(curve_label, "%d%s%d", src_idx,"-->", dst);
fl_set_xyplot_key(form_ul->owd, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_add_xyplot_overlay(form_ul->throughput,curve_id++,
otg_forms_info->data_ctime_ul[src_idx][dst],
otg_forms_info->data_throughput_ul[src_idx][dst],
otg_forms_info->idx_ul[src_idx][dst],src_idx+6);
sprintf(curve_label, "%d%s%d", src_idx,"-->", dst);
fl_set_xyplot_key(form_ul->throughput, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_ul->throughput,x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
}
if (otg_forms_info->is_data_plot_ul == -1)
otg_forms_info->is_data_plot_ul=src;
if (otg_forms_info->is_data_plot_ul == src) {
fl_set_xyplot_data (form_ul->owd, otg_forms_info->data_ctime_ul[src][dst],
otg_forms_info->data_owd_ul[src][dst], otg_forms_info->idx_ul[src][dst], "", "time", "ms");
sprintf(curve_label, "%d%s%d", src,"-->", dst);
fl_set_xyplot_key(form_ul->owd, 0, curve_label);
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_ul->throughput, otg_forms_info->data_ctime_ul[src][dst],
otg_forms_info->data_throughput_ul[src][dst], otg_forms_info->idx_ul[src][dst], "", "time", "kbit/s");
fl_set_xyplot_key(form_ul->throughput, 0, curve_label);
fl_set_xyplot_key_font(form_ul->throughput, FL_BOLD_STYLE, FL_HUGE_SIZE);
fl_set_xyplot_key_position(form_ul->throughput, x_key_position,y_key_position , FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts UL=", otg_info->total_loss_ul);
fl_set_object_label(form_ul->loss_ratio, loss_rate);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_ul->simu_time, simu_time);
} else {
fl_set_xyplot_data (form_ul->owd, otg_forms_info->data_ctime_ul[otg_forms_info->is_data_plot_ul][dst],
otg_forms_info->data_owd_ul[otg_forms_info->is_data_plot_ul][dst], otg_forms_info->idx_ul[otg_forms_info->is_data_plot_ul][dst], "", "time", "ms");
sprintf(curve_label, "%d%s%d", otg_forms_info->is_data_plot_ul,"-->", dst);
fl_set_xyplot_key(form_ul->owd, 0, curve_label);
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_ul->throughput, otg_forms_info->data_ctime_ul[otg_forms_info->is_data_plot_ul][dst],
otg_forms_info->data_throughput_ul[otg_forms_info->is_data_plot_ul][dst], otg_forms_info->idx_ul[otg_forms_info->is_data_plot_ul][dst], "", "time", "kbit/s");
sprintf(curve_label, "%d%s%d", otg_forms_info->is_data_plot_ul,"-->", dst);
fl_set_xyplot_key(form_ul->throughput, 0, curve_label);
fl_set_xyplot_key_position(form_ul->throughput, x_key_position,y_key_position , FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts UL=",otg_info->total_loss_ul);
fl_set_object_label(form_ul->loss_ratio, loss_rate);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_ul->simu_time, simu_time);
}
for (src_idx=1; src_idx<=NB_UE_INST; src_idx++) {
if (src_idx!=otg_forms_info->is_data_plot_ul) {
fl_add_xyplot_overlay(form_ul->owd,curve_id++,
otg_forms_info->data_ctime_ul[src_idx][dst],
otg_forms_info->data_owd_ul[src_idx][dst],
otg_forms_info->idx_ul[src_idx][dst],src_idx+6);
sprintf(curve_label, "%d%s%d", src_idx,"-->", dst);
fl_set_xyplot_key(form_ul->owd, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_ul->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_add_xyplot_overlay(form_ul->throughput,curve_id++,
otg_forms_info->data_ctime_ul[src_idx][dst],
otg_forms_info->data_throughput_ul[src_idx][dst],
otg_forms_info->idx_ul[src_idx][dst],src_idx+6);
sprintf(curve_label, "%d%s%d", src_idx,"-->", dst);
fl_set_xyplot_key(form_ul->throughput, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_ul->throughput,x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
}
}
for (i=0; i<otg_forms_info->idx_ul[src][dst]; i++) {
otg_forms_info->data_ctime_ul[src][dst][otg_forms_info->idx_ul[src][dst]]=i;
otg_forms_info->data_owd_ul[src][dst][i]= otg_forms_info->data_owd_ul[src][dst][i+1];
otg_forms_info->data_throughput_ul[src][dst][i]= otg_forms_info->data_throughput_ul[src][dst][i+1];
}
otg_forms_info->idx_ul[src][dst]--;
}
for (i=0;i<otg_forms_info->idx_ul[src][dst];i++){
otg_forms_info->data_ctime_ul[src][dst][otg_forms_info->idx_ul[src][dst]]=i;
otg_forms_info->data_owd_ul[src][dst][i]= otg_forms_info->data_owd_ul[src][dst][i+1];
otg_forms_info->data_throughput_ul[src][dst][i]= otg_forms_info->data_throughput_ul[src][dst][i+1];
}
otg_forms_info->idx_ul[src][dst]--;
}
fl_check_forms();
fl_check_forms();
}
@@ -264,91 +269,91 @@ if (otg_forms_info->idx_ul[src][dst]==MAX_SAMPLES-1){
void plot_graphes_dl(int src, int dst, int ctime) //eNB -->UE
{
int i, dst_idx=1, curve_id=1;
char loss_rate[100];
char curve_label[100];
char simu_time[100];
int x_key_position=27;
int y_key_position=75;
int i, dst_idx=1, curve_id=1;
char loss_rate[100];
char curve_label[100];
char simu_time[100];
int x_key_position=27;
int y_key_position=75;
if (otg_forms_info->idx_dl[src][dst]==MAX_SAMPLES-1){
if (otg_forms_info->idx_dl[src][dst]==MAX_SAMPLES-1) {
fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server
fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server
if (otg_forms_info->is_data_plot_dl == -1)
otg_forms_info->is_data_plot_dl=dst;
if (otg_forms_info->is_data_plot_dl == dst) {
fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][dst],
otg_forms_info->data_owd_dl[src][dst], otg_forms_info->idx_dl[src][dst], "", "time", "ms");
sprintf(curve_label, "%d%s%d", src,"-->", dst);
fl_set_xyplot_key(form_dl->owd, 0, curve_label);
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_dl->throughput, otg_forms_info->data_ctime_dl[src][dst],
otg_forms_info->data_throughput_dl[src][dst], otg_forms_info->idx_dl[src][dst], "", "time", "kbit/s");
sprintf(curve_label, "%d%s%d", src,"-->", dst);
fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
fl_set_object_label(form_dl->loss_ratio, loss_rate);
if (otg_forms_info->is_data_plot_dl == -1)
otg_forms_info->is_data_plot_dl=dst;
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_dl->simu_time, simu_time);
if (otg_forms_info->is_data_plot_dl == dst) {
fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][dst],
otg_forms_info->data_owd_dl[src][dst], otg_forms_info->idx_dl[src][dst], "", "time", "ms");
sprintf(curve_label, "%d%s%d", src,"-->", dst);
fl_set_xyplot_key(form_dl->owd, 0, curve_label);
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_dl->throughput, otg_forms_info->data_ctime_dl[src][dst],
otg_forms_info->data_throughput_dl[src][dst], otg_forms_info->idx_dl[src][dst], "", "time", "kbit/s");
sprintf(curve_label, "%d%s%d", src,"-->", dst);
fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
fl_set_object_label(form_dl->loss_ratio, loss_rate);
}
else {
fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
otg_forms_info->data_owd_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "ms");
sprintf(curve_label, "%d%s%d", src,"-->", otg_forms_info->is_data_plot_dl);
fl_set_xyplot_key(form_dl->owd, 0, curve_label);
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_dl->throughput, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
otg_forms_info->data_throughput_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "kB/s");
sprintf(curve_label, "%d%s%d", src,"-->",otg_forms_info->is_data_plot_dl);
fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
fl_set_xyplot_key_position(form_dl->throughput,x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
fl_set_object_label(form_dl->loss_ratio, loss_rate);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_dl->simu_time, simu_time);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_dl->simu_time, simu_time);
} else {
fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
otg_forms_info->data_owd_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "ms");
sprintf(curve_label, "%d%s%d", src,"-->", otg_forms_info->is_data_plot_dl);
fl_set_xyplot_key(form_dl->owd, 0, curve_label);
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_set_xyplot_data (form_dl->throughput, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
otg_forms_info->data_throughput_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "kB/s");
sprintf(curve_label, "%d%s%d", src,"-->",otg_forms_info->is_data_plot_dl);
fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
fl_set_xyplot_key_position(form_dl->throughput,x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
otg_kpi_nb_loss_pkts();
sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
fl_set_object_label(form_dl->loss_ratio, loss_rate);
sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
fl_set_object_label(form_dl->simu_time, simu_time);
}
for (dst_idx=1; dst_idx<=NB_UE_INST; dst_idx++) {
if (dst_idx!=otg_forms_info->is_data_plot_dl) {
fl_add_xyplot_overlay(form_dl->owd,curve_id++,
otg_forms_info->data_ctime_dl[src][dst_idx],
otg_forms_info->data_owd_dl[src][dst_idx],
otg_forms_info->idx_dl[src][dst_idx],dst_idx+6);
sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
fl_set_xyplot_key(form_dl->owd, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_add_xyplot_overlay(form_dl->throughput,curve_id++,
otg_forms_info->data_ctime_dl[src][dst_idx],
otg_forms_info->data_throughput_dl[src][dst_idx],
otg_forms_info->idx_dl[src][dst_idx],dst_idx+6);
sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
fl_set_xyplot_key(form_dl->throughput, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
}
}
for (i=0; i<otg_forms_info->idx_dl[src][dst]; i++) {
otg_forms_info->data_ctime_dl[src][dst][otg_forms_info->idx_dl[src][dst]]=i;
otg_forms_info->data_owd_dl[src][dst][i]= otg_forms_info->data_owd_dl[src][dst][i+1];
otg_forms_info->data_throughput_dl[src][dst][i]= otg_forms_info->data_throughput_dl[src][dst][i+1];
}
otg_forms_info->idx_dl[src][dst]--;
}
for (dst_idx=1;dst_idx<=NB_UE_INST;dst_idx++){
if (dst_idx!=otg_forms_info->is_data_plot_dl){
fl_add_xyplot_overlay(form_dl->owd,curve_id++,
otg_forms_info->data_ctime_dl[src][dst_idx],
otg_forms_info->data_owd_dl[src][dst_idx],
otg_forms_info->idx_dl[src][dst_idx],dst_idx+6);
sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
fl_set_xyplot_key(form_dl->owd, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
fl_add_xyplot_overlay(form_dl->throughput,curve_id++,
otg_forms_info->data_ctime_dl[src][dst_idx],
otg_forms_info->data_throughput_dl[src][dst_idx],
otg_forms_info->idx_dl[src][dst_idx],dst_idx+6);
sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
fl_set_xyplot_key(form_dl->throughput, curve_id-1, curve_label);
fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position, FL_ALIGN_BOTTOM_LEFT);
}
}
for (i=0;i<otg_forms_info->idx_dl[src][dst];i++){
otg_forms_info->data_ctime_dl[src][dst][otg_forms_info->idx_dl[src][dst]]=i;
otg_forms_info->data_owd_dl[src][dst][i]= otg_forms_info->data_owd_dl[src][dst][i+1];
otg_forms_info->data_throughput_dl[src][dst][i]= otg_forms_info->data_throughput_dl[src][dst][i+1];
}
otg_forms_info->idx_dl[src][dst]--;
}
fl_check_forms();
fl_check_forms();
}
@@ -359,36 +364,36 @@ if (otg_forms_info->idx_dl[src][dst]==MAX_SAMPLES-1){
void exit_cb(FL_OBJECT *ob, long q)
{
fl_finish();
exit(0);
fl_finish();
exit(0);
}
void create_form_clock(void)
{
FL_OBJECT *obj;
FL_OBJECT *obj;
if (fclock)
return;
if (fclock)
return;
fclock = fl_bgn_form(FL_NO_BOX,500,350);
obj = fl_add_box(FL_UP_BOX,0,0,500,350,"");
fclock = fl_bgn_form(FL_NO_BOX,500,350);
obj = fl_add_box(FL_UP_BOX,0,0,500,350,"");
obj = fl_add_clock(FL_DIGITAL_CLOCK,185,20,150,35,"");
fl_set_object_boxtype(obj,FL_ROUNDED_BOX);
fl_set_object_color(obj,FL_COL1,FL_BLACK);
fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
fl_set_object_lstyle(obj,FL_BOLD_STYLE);
obj = fl_add_clock(FL_DIGITAL_CLOCK,185,20,150,35,"");
fl_set_object_boxtype(obj,FL_ROUNDED_BOX);
fl_set_object_color(obj,FL_COL1,FL_BLACK);
fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
fl_set_object_lstyle(obj,FL_BOLD_STYLE);
obj = fl_add_clock(FL_ANALOG_CLOCK,30,70,220,200,"");
fl_set_object_boxtype(obj,FL_UP_BOX);
obj = fl_add_clock(FL_ANALOG_CLOCK,30,70,220,200,"");
fl_set_object_boxtype(obj,FL_UP_BOX);
obj = fl_add_clock(FL_ANALOG_CLOCK,260,70,220,200,"");
fl_set_object_boxtype(obj,FL_OVAL3D_UPBOX);
obj = fl_add_button(FL_NORMAL_BUTTON,375,300,110,35,"Exit");
fl_set_object_callback(obj, exit_cb, 0);
fl_end_form();
obj = fl_add_clock(FL_ANALOG_CLOCK,260,70,220,200,"");
fl_set_object_boxtype(obj,FL_OVAL3D_UPBOX);
obj = fl_add_button(FL_NORMAL_BUTTON,375,300,110,35,"Exit");
fl_set_object_callback(obj, exit_cb, 0);
fl_end_form();
fl_scale_form(fclock, 0.7, 0.7);
fl_scale_form(fclock, 0.7, 0.7);
}
+7 -7
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
#ifndef __OTG_FORM_H__
# define __OTG_FORM_H__
# define __OTG_FORM_H__
#include <forms.h>
#include <stdlib.h>
@@ -39,11 +39,11 @@
/**** Forms and Objects ****/
typedef struct {
FL_FORM *otg;
FL_OBJECT *owd;
FL_OBJECT *throughput;
FL_OBJECT *loss_ratio;
FL_OBJECT *simu_time;
FL_FORM *otg;
FL_OBJECT *owd;
FL_OBJECT *throughput;
FL_OBJECT *loss_ratio;
FL_OBJECT *simu_time;
} FD_otg;
extern FD_otg * create_form_otg(void);
@@ -55,4 +55,4 @@ void create_form_clock(void);
void exit_cb(FL_OBJECT *ob, long q);
#endif
#endif
File diff suppressed because it is too large Load Diff
+15 -15
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_kpi.h functions to compute OTG KPIs
* \brief desribe function for KPIs computation
* \brief desribe function for KPIs computation
* \author navid nikaein and A. Hafsaoui
* \date 2012
* \version 0.1
@@ -40,7 +40,7 @@
*/
#ifndef __OTG_KPI_H__
# define __OTG_KPI_H__
# define __OTG_KPI_H__
#include <stdio.h>
@@ -59,26 +59,26 @@ extern unsigned int start_log_jitter;
* \brief compute the transmitter throughput in bytes per seconds
* \param[in] Source, destination, application
* \param[out]
* \note
* \note
* @ingroup _otg
*/
void tx_throughput( int src, int dst, int application);
/*! \fn void rx_goodput( int src, int dst)
* \brief compute the receiver goodput in bytes per seconds
* \param[in] Source, destination, application
* \param[out]
* \note
* \param[in] Source, destination, application
* \param[out]
* \note
* @ingroup _otg
*/
void rx_goodput( int src, int dst,int application);
/*void rx_loss_rate_pkts(int src, int dst, int application)
* \brief compute the loss rate in bytes at the server bytes
* \param[in] Source, destination, application
* \param[out]
* \note
* \param[out]
* \note
* @ingroup _otg
*/
void rx_loss_rate_pkts(int src, int dst, int application);
@@ -86,17 +86,17 @@ void rx_loss_rate_pkts(int src, int dst, int application);
/*void rx_loss_rate_bytes(int src, int dst, int application)
* \brief compute the loss rate in pkts at the server bytes
* \param[in] Source, destination, application
* \param[out]
* \note
* \param[out]
* \note
* @ingroup _otg
*/
void rx_loss_rate_bytes(int src, int dst, int application);
/*void kpi_gen(void)
* \brief compute KPIs after the end of the simulation
* \param[in]
* \param[out]
* \note
* \brief compute KPIs after the end of the simulation
* \param[in]
* \param[out]
* \note
* @ingroup _otg
*/
void kpi_gen(void);
+390 -299
View File
@@ -29,7 +29,7 @@
/*! \file otg_models.c
* \brief function containing the OTG TX traffic generation functions
* \brief function containing the OTG TX traffic generation functions
* \author M. Laner and navid nikaein
* \date 2013
* \version 0.1
@@ -46,57 +46,65 @@
/*all the TARMA stuff:
this is based on the modelling framework provided in
"M. Laner, P. Svoboda and M. Rupp, Modeling Randomness in Network Traffic, SIGMETRICS/Performance'12, London, UK, 2012".
this is based on the modelling framework provided in
"M. Laner, P. Svoboda and M. Rupp, Modeling Randomness in Network Traffic, SIGMETRICS/Performance'12, London, UK, 2012".
*/
/* this function must be called for each random process and each time it shall produce a new random sample,
which is the return value
input: - inputSamples: an array of length TARMA_NUM_PROCESSES with iid gaussian samples
which must be the same for xcorrelated processes
- proc: pointer to tarmaProcess_t
output: - the next value in the random process
/* this function must be called for each random process and each time it shall produce a new random sample,
which is the return value
input: - inputSamples: an array of length TARMA_NUM_PROCESSES with iid gaussian samples
which must be the same for xcorrelated processes
- proc: pointer to tarmaProcess_t
output: - the next value in the random process
*/
double tarmaCalculateSample( double inputSamples[], tarmaProcess_t *proc){
double tarmaCalculateSample( double inputSamples[], tarmaProcess_t *proc)
{
/* struct with all definitions of the random process and its history */
int cnt;
double X, Y, Ypower, Z;
/* calculate the current sample X' by weighting the input samples */
X=0;
for( cnt=0; cnt<TARMA_NUM_PROCESSES ; cnt++){
X += proc->inputWeight[cnt]*inputSamples[cnt];
for( cnt=0; cnt<TARMA_NUM_PROCESSES ; cnt++) {
X += proc->inputWeight[cnt]*inputSamples[cnt];
}
/* update the MA history: shift everything back for one lag */
for( cnt=TARMA_NUM_MA_MAX-1; cnt>0; cnt--){
proc->maHist[cnt] = proc->maHist[cnt-1];
for( cnt=TARMA_NUM_MA_MAX-1; cnt>0; cnt--) {
proc->maHist[cnt] = proc->maHist[cnt-1];
}
proc->maHist[0]=X; /* update the MA history with the current filter input value */
/* update the AR history: shift everything back for one lag */
for( cnt=TARMA_NUM_AR_MAX-1; cnt>0; cnt--){
proc->arHist[cnt] = proc->arHist[cnt-1];
for( cnt=TARMA_NUM_AR_MAX-1; cnt>0; cnt--) {
proc->arHist[cnt] = proc->arHist[cnt-1];
}
proc->arHist[0]=0; /* caution: arHist[0] must not be used for the filter processing! */
/* filter processing */
Y=0;
for( cnt=0; cnt<TARMA_NUM_MA_MAX; cnt++){ /* moving average part, start at lag 0 = current X */
Y += proc->maWeight[cnt] * proc->maHist[cnt];
for( cnt=0; cnt<TARMA_NUM_MA_MAX; cnt++) { /* moving average part, start at lag 0 = current X */
Y += proc->maWeight[cnt] * proc->maHist[cnt];
}
for( cnt=1; cnt<TARMA_NUM_AR_MAX; cnt++){ /* auto regressive part, start at lag 1 = former Y */
Y += -proc->arWeight[cnt] * proc->arHist[cnt];
for( cnt=1; cnt<TARMA_NUM_AR_MAX; cnt++) { /* auto regressive part, start at lag 1 = former Y */
Y += -proc->arWeight[cnt] * proc->arHist[cnt];
}
proc->arHist[0]=Y; /* update the AR history with the current filter output value */
/* polynomial transformation */
Z=0;
Ypower=1;
for(cnt=0; cnt<TARMA_NUM_POLY_MAX; cnt++){
Z += proc->polyWeight[cnt]*Ypower;
Ypower *= Y;
for(cnt=0; cnt<TARMA_NUM_POLY_MAX; cnt++) {
Z += proc->polyWeight[cnt]*Ypower;
Ypower *= Y;
}
LOG_D(OTG,"TARMA_DEBUG: tarmaCalculateSamples called: Z=%f\n",Z);
@@ -106,65 +114,76 @@ double tarmaCalculateSample( double inputSamples[], tarmaProcess_t *proc){
/*
this function must be called each time before size and itd are generated for the respective packet.
it updates the input samples stored in the structure stream,
ps: calling it more often than for each packet is also fine
input: - the stream to be updated
output:
it updates the input samples stored in the structure stream,
ps: calling it more often than for each packet is also fine
input: - the stream to be updated
output:
*/
void tarmaUpdateInputSample (tarmaStream_t *stream){
void tarmaUpdateInputSample (tarmaStream_t *stream)
{
int cnt;
LOG_T(OTG,"TARMA_DEBUG: tarmaUpdateInputSample(%p)\n", stream);
if(stream){
for(cnt=0; cnt<TARMA_NUM_PROCESSES; cnt++){
stream->tarma_input_samples[cnt]=gaussian_dist(10000,1)-10000;
LOG_D(OTG,"TARMA_DEBUG: %f\n",stream->tarma_input_samples[cnt]);
}
if(stream) {
for(cnt=0; cnt<TARMA_NUM_PROCESSES; cnt++) {
stream->tarma_input_samples[cnt]=gaussian_dist(10000,1)-10000;
LOG_D(OTG,"TARMA_DEBUG: %f\n",stream->tarma_input_samples[cnt]);
}
}
}
/*
this function initializes the given stream, it allocates the respective memory if necessary (stream=0)
and sets all the respective values to zero.
input: - steam to be initialized (or zero if memory shall be allocated)
output: - the same stream
and sets all the respective values to zero.
input: - steam to be initialized (or zero if memory shall be allocated)
output: - the same stream
*/
tarmaStream_t *tarmaInitStream(tarmaStream_t *stream){
if(stream==0){
stream=(tarmaStream_t*) malloc(sizeof(tarmaStream_t));
tarmaStream_t *tarmaInitStream(tarmaStream_t *stream)
{
if(stream==0) {
stream=(tarmaStream_t*) malloc(sizeof(tarmaStream_t));
}
tarmaProcess_t *proc;
int cntvar, cntp, cntma, cntar, cntpy;
for(cntvar=0; cntvar<2; cntvar++){
if(cntvar==0){
proc=&(stream->tarma_idt);
}else{
proc=&(stream->tarma_size);
}
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++){
proc->inputWeight[cntp]=0;
}
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++){
proc->maWeight[cntma]=0;
proc->maHist[cntma]=0;
}
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++){
proc->arWeight[cntar]=0;
proc->arHist[cntar]=0;
}
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
proc->polyWeight[cntpy]=0;
}
for(cntvar=0; cntvar<2; cntvar++) {
if(cntvar==0) {
proc=&(stream->tarma_idt);
} else {
proc=&(stream->tarma_size);
}
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++) {
proc->inputWeight[cntp]=0;
}
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++) {
proc->maWeight[cntma]=0;
proc->maHist[cntma]=0;
}
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++) {
proc->arWeight[cntar]=0;
proc->arHist[cntar]=0;
}
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
proc->polyWeight[cntpy]=0;
}
}
LOG_D(OTG,"TARMA_DEBUG: tarmaInitStream(%p) called\n", stream);
return stream;
}
/*
/*
this function initializes the input stream according to the openarena traffic modelling
input: - stream to be initialized
output:
input: - stream to be initialized
output:
*/
void tarmaSetupOpenarenaDownlink(tarmaStream_t *stream){
void tarmaSetupOpenarenaDownlink(tarmaStream_t *stream)
{
stream->tarma_size.inputWeight[0]=1;
stream->tarma_size.maWeight[0]=0.6;
stream->tarma_size.maWeight[1]=-1.04;
@@ -181,61 +200,75 @@ void tarmaSetupOpenarenaDownlink(tarmaStream_t *stream){
//tarmaPrintStreamInit(stream);
}
/*
/*
this function prints the actual history of a random process
input: - random process
output:
input: - random process
output:
*/
void tarmaPrintProc(tarmaProcess_t *proc){
void tarmaPrintProc(tarmaProcess_t *proc)
{
char prefix[]="OTG TARMA DEBUG: ";
int cntma, cntar;
printf("%s tarmaPrintProc(%p) called\n", prefix, proc);
printf("%s ma history:\n",prefix);
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++){
printf("%s ma[%d]: %f\n",prefix,cntma,proc->maHist[cntma]);
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++) {
printf("%s ma[%d]: %f\n",prefix,cntma,proc->maHist[cntma]);
}
printf("%s ar history:\n",prefix);
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++){
printf("%s ar[%d]: %f\n",prefix,cntar,proc->arHist[cntar]);
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++) {
printf("%s ar[%d]: %f\n",prefix,cntar,proc->arHist[cntar]);
}
}
/*
/*
this function prints the fixed (weigths) parameters of the input stream
input: - stream to be printed
output:
input: - stream to be printed
output:
*/
void tarmaPrintStreamInit(tarmaStream_t *stream){
void tarmaPrintStreamInit(tarmaStream_t *stream)
{
char prefix[]="OTG TARMA DEBUG: ";
tarmaProcess_t *proc;
int cntvar, cntp, cntma, cntar, cntpy;
printf("%s tarmaPrintStreamInit(%p) called\n", prefix, stream);
for(cntvar=0; cntvar<2; cntvar++){
if(cntvar==0){
proc=&(stream->tarma_idt);
printf("%s variable: idt\n",prefix);
}else{
proc=&(stream->tarma_size);
printf("%s variable: size\n",prefix);
}
printf("%s input processes\n",prefix);
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++){
printf("%s w_pr[%d]: %f\n",prefix,cntp,proc->inputWeight[cntp]);
}
printf("%s moving average weights\n",prefix);
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++){
printf("%s w_ma[%d]: %f\n",prefix,cntma,proc->maWeight[cntma]);
}
printf("%s auto-regressive weights\n",prefix);
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++){
printf("%s w_ar[%d]: %f\n",prefix,cntar,proc->arWeight[cntar]);
}
printf("%s polynomial factors\n",prefix);
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
printf("%s w_py[%d]: %f\n",prefix,cntpy,proc->polyWeight[cntpy]);
}
for(cntvar=0; cntvar<2; cntvar++) {
if(cntvar==0) {
proc=&(stream->tarma_idt);
printf("%s variable: idt\n",prefix);
} else {
proc=&(stream->tarma_size);
printf("%s variable: size\n",prefix);
}
printf("%s input processes\n",prefix);
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++) {
printf("%s w_pr[%d]: %f\n",prefix,cntp,proc->inputWeight[cntp]);
}
printf("%s moving average weights\n",prefix);
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++) {
printf("%s w_ma[%d]: %f\n",prefix,cntma,proc->maWeight[cntma]);
}
printf("%s auto-regressive weights\n",prefix);
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++) {
printf("%s w_ar[%d]: %f\n",prefix,cntar,proc->arWeight[cntar]);
}
printf("%s polynomial factors\n",prefix);
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
printf("%s w_py[%d]: %f\n",prefix,cntpy,proc->polyWeight[cntpy]);
}
}
}
@@ -244,142 +277,167 @@ void tarmaPrintStreamInit(tarmaStream_t *stream){
everything about video modeling which is an extended version of tarma modeling
*/
/*
/*
this function calculates the packet size (frame size) for each video frame,
the idt is always fixed to the framerate (i.e., between 20 and 50 fps, default=25)
input: - vidoe stream
output: - frame size
the idt is always fixed to the framerate (i.e., between 20 and 50 fps, default=25)
input: - vidoe stream
output: - frame size
*/
double tarmaCalculateVideoSample(tarmaVideo_t *video){
double tarmaCalculateVideoSample(tarmaVideo_t *video)
{
double size=0;
double inputsamples[TARMA_NUM_PROCESSES];
tarmaProcess_t *proc;
int frameidx;
int cntp, cntpy;
if(video){
proc=&(video->tarma_size);
frameidx=video->tarmaVideoGopStructure[video->tarmaVideoFrameNumber];
LOG_D(OTG,"TARMA_DEBUG: tarmaCalculateVideoSample(%p) called\n", video);
LOG_D(OTG,"TARMA_DEBUG: frameidx=%d\n",frameidx);
if(frameidx>=0 && frameidx<TARMA_NUM_FRAME_TYPES){
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
proc->polyWeight[cntpy]=video->polyWeightFrame[frameidx][cntpy];
}
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++){
inputsamples[cntp]=gaussian_dist(10000,1)-10000;
}
size=tarmaCalculateSample(inputsamples,proc);
}
/*get ready for the next frame*/
video->tarmaVideoFrameNumber++;
if(video->tarmaVideoFrameNumber>=TARMA_NUM_GOP_MAX){
video->tarmaVideoFrameNumber=0;
}
if(video->tarmaVideoGopStructure[video->tarmaVideoFrameNumber]<0 ||
video->tarmaVideoGopStructure[video->tarmaVideoFrameNumber]>TARMA_NUM_FRAME_TYPES){
video->tarmaVideoFrameNumber=0;
}
if(video) {
proc=&(video->tarma_size);
frameidx=video->tarmaVideoGopStructure[video->tarmaVideoFrameNumber];
LOG_D(OTG,"TARMA_DEBUG: tarmaCalculateVideoSample(%p) called\n", video);
LOG_D(OTG,"TARMA_DEBUG: frameidx=%d\n",frameidx);
if(frameidx>=0 && frameidx<TARMA_NUM_FRAME_TYPES) {
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
proc->polyWeight[cntpy]=video->polyWeightFrame[frameidx][cntpy];
}
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++) {
inputsamples[cntp]=gaussian_dist(10000,1)-10000;
}
size=tarmaCalculateSample(inputsamples,proc);
}
/*get ready for the next frame*/
video->tarmaVideoFrameNumber++;
if(video->tarmaVideoFrameNumber>=TARMA_NUM_GOP_MAX) {
video->tarmaVideoFrameNumber=0;
}
if(video->tarmaVideoGopStructure[video->tarmaVideoFrameNumber]<0 ||
video->tarmaVideoGopStructure[video->tarmaVideoFrameNumber]>TARMA_NUM_FRAME_TYPES) {
video->tarmaVideoFrameNumber=0;
}
}
return size;
}
/*
/*
this function initializes a video stream (and allocates memory if needed)
input: - video stream (or zero if memory should be allocated)
output: - the same video stream
input: - video stream (or zero if memory should be allocated)
output: - the same video stream
*/
tarmaVideo_t *tarmaInitVideo(tarmaVideo_t *video){
tarmaVideo_t *tarmaInitVideo(tarmaVideo_t *video)
{
tarmaProcess_t *proc;
int cntp, cntma, cntar, cntpy, cntgop, cnttype;
LOG_D(OTG,"TARMA_DEBUG: tarmaInitVideo(%p) called\n", video);
if(video==0){
video=(tarmaVideo_t*) malloc(sizeof(tarmaVideo_t));
if(video==0) {
video=(tarmaVideo_t*) malloc(sizeof(tarmaVideo_t));
}
proc=&(video->tarma_size);
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++){
proc->inputWeight[cntp]=0;
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++) {
proc->inputWeight[cntp]=0;
}
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++){
proc->maWeight[cntma]=0;
proc->maHist[cntma]=0;
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++) {
proc->maWeight[cntma]=0;
proc->maHist[cntma]=0;
}
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++){
proc->arWeight[cntar]=0;
proc->arHist[cntar]=0;
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++) {
proc->arWeight[cntar]=0;
proc->arHist[cntar]=0;
}
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
proc->polyWeight[cntpy]=0;
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
proc->polyWeight[cntpy]=0;
}
video->tarmaVideoFrameNumber=0;
for(cntgop=0; cntgop<TARMA_NUM_GOP_MAX; cntgop++){
video->tarmaVideoGopStructure[cntgop]=-1;
for(cntgop=0; cntgop<TARMA_NUM_GOP_MAX; cntgop++) {
video->tarmaVideoGopStructure[cntgop]=-1;
}
for(cnttype=0; cnttype<TARMA_NUM_FRAME_TYPES; cnttype++){
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
video->polyWeightFrame[cnttype][cntpy]=0;
}
for(cnttype=0; cnttype<TARMA_NUM_FRAME_TYPES; cnttype++) {
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
video->polyWeightFrame[cnttype][cntpy]=0;
}
}
return video;
}
/*
/*
this function initializes a video stream according to a tarma model
input: - video to be initialized
- compression rate: 1...dvd quality
output:
input: - video to be initialized
- compression rate: 1...dvd quality
output:
*/
void tarmaSetupVideoGop12(tarmaVideo_t *video, double compression){
if(video){
video->tarma_size.inputWeight[0]=1;
video->tarma_size.maWeight[0]=0.47;
video->tarma_size.maWeight[1]=-0.829;
video->tarma_size.maWeight[2]=0.358;
video->tarma_size.arWeight[0]=1;
video->tarma_size.arWeight[1]=-1.984;
video->tarma_size.arWeight[2]=0.984;
video->tarmaVideoGopStructure[0]=0; /*i frame*/
video->tarmaVideoGopStructure[1]=2; /*b frame*/
video->tarmaVideoGopStructure[2]=2;
video->tarmaVideoGopStructure[3]=1; /*p frame*/
video->tarmaVideoGopStructure[4]=2;
video->tarmaVideoGopStructure[5]=2;
video->tarmaVideoGopStructure[6]=1;
video->tarmaVideoGopStructure[7]=2;
video->tarmaVideoGopStructure[8]=2;
video->tarmaVideoGopStructure[9]=1;
video->tarmaVideoGopStructure[10]=2;
video->tarmaVideoGopStructure[11]=2;
if(compression<1){compression=1;}
video->polyWeightFrame[0][0]=55400/compression; /*i frame*/
video->polyWeightFrame[0][1]=32300/compression;
video->polyWeightFrame[0][2]=10400/compression;
video->polyWeightFrame[0][3]=-100/compression;
video->polyWeightFrame[0][4]=-800/compression;
video->polyWeightFrame[0][5]=74/compression;
video->polyWeightFrame[1][0]=20900/compression; /*p frame*/
video->polyWeightFrame[1][1]=19100/compression;
video->polyWeightFrame[1][2]=7150/compression;
video->polyWeightFrame[1][3]=-740/compression;
video->polyWeightFrame[1][4]=-130/compression;
video->polyWeightFrame[1][5]=20/compression;
video->polyWeightFrame[2][0]=11700/compression; /*b frame*/
video->polyWeightFrame[2][1]=10300/compression;
video->polyWeightFrame[2][2]=4320/compression;
video->polyWeightFrame[2][3]=700/compression;
video->polyWeightFrame[2][4]=-90/compression;
video->polyWeightFrame[2][5]=-2/compression;
tarmaPrintVideoInit(video);
void tarmaSetupVideoGop12(tarmaVideo_t *video, double compression)
{
if(video) {
video->tarma_size.inputWeight[0]=1;
video->tarma_size.maWeight[0]=0.47;
video->tarma_size.maWeight[1]=-0.829;
video->tarma_size.maWeight[2]=0.358;
video->tarma_size.arWeight[0]=1;
video->tarma_size.arWeight[1]=-1.984;
video->tarma_size.arWeight[2]=0.984;
video->tarmaVideoGopStructure[0]=0; /*i frame*/
video->tarmaVideoGopStructure[1]=2; /*b frame*/
video->tarmaVideoGopStructure[2]=2;
video->tarmaVideoGopStructure[3]=1; /*p frame*/
video->tarmaVideoGopStructure[4]=2;
video->tarmaVideoGopStructure[5]=2;
video->tarmaVideoGopStructure[6]=1;
video->tarmaVideoGopStructure[7]=2;
video->tarmaVideoGopStructure[8]=2;
video->tarmaVideoGopStructure[9]=1;
video->tarmaVideoGopStructure[10]=2;
video->tarmaVideoGopStructure[11]=2;
if(compression<1) {
compression=1;
}
video->polyWeightFrame[0][0]=55400/compression; /*i frame*/
video->polyWeightFrame[0][1]=32300/compression;
video->polyWeightFrame[0][2]=10400/compression;
video->polyWeightFrame[0][3]=-100/compression;
video->polyWeightFrame[0][4]=-800/compression;
video->polyWeightFrame[0][5]=74/compression;
video->polyWeightFrame[1][0]=20900/compression; /*p frame*/
video->polyWeightFrame[1][1]=19100/compression;
video->polyWeightFrame[1][2]=7150/compression;
video->polyWeightFrame[1][3]=-740/compression;
video->polyWeightFrame[1][4]=-130/compression;
video->polyWeightFrame[1][5]=20/compression;
video->polyWeightFrame[2][0]=11700/compression; /*b frame*/
video->polyWeightFrame[2][1]=10300/compression;
video->polyWeightFrame[2][2]=4320/compression;
video->polyWeightFrame[2][3]=700/compression;
video->polyWeightFrame[2][4]=-90/compression;
video->polyWeightFrame[2][5]=-2/compression;
tarmaPrintVideoInit(video);
}
}
/*
/*
this function prints the fixed (weigths) parameters of the input video stream
input: - video stream to be printed
output:
input: - video stream to be printed
output:
*/
void tarmaPrintVideoInit(tarmaVideo_t *video){
void tarmaPrintVideoInit(tarmaVideo_t *video)
{
char prefix[]="OTG TARMA DEBUG: ";
tarmaProcess_t *proc;
int cntp, cntma, cntar, cntpy, cntgop, cnttype;
@@ -387,33 +445,46 @@ void tarmaPrintVideoInit(tarmaVideo_t *video){
printf("%s tarmaPrintVideoInit(%p) called\n", prefix, video);
proc=&(video->tarma_size);
printf("%s input process weights\n",prefix);
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++){
printf("%s w[%d]=%f\n",prefix,cntp,proc->inputWeight[cntp]);
for(cntp=0; cntp<TARMA_NUM_PROCESSES; cntp++) {
printf("%s w[%d]=%f\n",prefix,cntp,proc->inputWeight[cntp]);
}
printf("%s ma weights\n",prefix);
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++){
printf("%s ma[%d]=%f\n",prefix,cntma,proc->maWeight[cntma]);
for(cntma=0; cntma<TARMA_NUM_MA_MAX; cntma++) {
printf("%s ma[%d]=%f\n",prefix,cntma,proc->maWeight[cntma]);
}
printf("%s ar weights\n",prefix);
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++){
printf("%s ar[%d]=%f\n",prefix,cntar,proc->arWeight[cntar]);
for(cntar=0; cntar<TARMA_NUM_AR_MAX; cntar++) {
printf("%s ar[%d]=%f\n",prefix,cntar,proc->arWeight[cntar]);
}
printf("%s polynomial weights\n",prefix);
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
printf("%s p[%d]=%f\n",prefix,cntpy,proc->polyWeight[cntpy]);
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
printf("%s p[%d]=%f\n",prefix,cntpy,proc->polyWeight[cntpy]);
}
printf("%s video frame number=%d\n",prefix,video->tarmaVideoFrameNumber);
printf("%s gop structure\n",prefix);
for(cntgop=0; cntgop<TARMA_NUM_GOP_MAX; cntgop++){
printf("%s gop[%d]=%d\n",prefix,cntgop,video->tarmaVideoGopStructure[cntgop]);
for(cntgop=0; cntgop<TARMA_NUM_GOP_MAX; cntgop++) {
printf("%s gop[%d]=%d\n",prefix,cntgop,video->tarmaVideoGopStructure[cntgop]);
}
printf("%s frame poly weights\n",prefix);
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++){
printf("%s [%d] ",prefix,cntpy);
for(cnttype=0; cnttype<TARMA_NUM_FRAME_TYPES; cnttype++){
printf(" %05.3f",video->polyWeightFrame[cnttype][cntpy]);
}
printf("\n");
printf("%s frame poly weights\n",prefix);
for(cntpy=0; cntpy<TARMA_NUM_POLY_MAX; cntpy++) {
printf("%s [%d] ",prefix,cntpy);
for(cnttype=0; cnttype<TARMA_NUM_FRAME_TYPES; cnttype++) {
printf(" %05.3f",video->polyWeightFrame[cnttype][cntpy]);
}
printf("\n");
}
}
@@ -421,67 +492,76 @@ void tarmaPrintVideoInit(tarmaVideo_t *video){
/*
everything about background traffic modeling according to
/*
everything about background traffic modeling according to
"M. Laner, P. Svoboda, S. Schwarz, M. Rupp, Users in Cells: a Data Traffic Analysis, WCNC'12, Paris, France, 2012".
*/
/*
this function creates a random realization of the mean data rate of a background-session
input:
output: - random realization of R_s (B/s)
/*
this function creates a random realization of the mean data rate of a background-session
input:
output: - random realization of R_s (B/s)
*/
double backgroundRateRnd(void){
double backgroundRateRnd(void)
{
double rate;
rate=pow(10,lognormal_dist(1.3525, 0.1954))/8; /*Byte/s*/;
if(rate>BACKGROUND_RATE_MAX){
rate=BACKGROUND_RATE_MAX;
}else if(rate<0){
rate=0;
if(rate>BACKGROUND_RATE_MAX) {
rate=BACKGROUND_RATE_MAX;
} else if(rate<0) {
rate=0;
}
return rate;
}
/*
/*
this function creates a random realization of the session duration of a background-session
input:
output: - random realization of D_s (ms)
input:
output: - random realization of D_s (ms)
*/
int backgroundSessionDurationRnd(void){
int backgroundSessionDurationRnd(void)
{
int duration;
duration = ceil(pow(10,exponential_dist(1/0.3591))*1000); /*ms*/
if(duration<0){
duration=0;
}else if(duration>1<<30){
duration=1<<30;
if(duration<0) {
duration=0;
} else if(duration>1<<30) {
duration=1<<30;
}
return duration;
}
/*
/*
this function initializes a background stream and allocates memory if needed
input: - the bg-stream (or zero if memory shall be allocated)
- the mean number of users (sessions) to be expected for this stream
output: - the same bg-stream
input: - the bg-stream (or zero if memory shall be allocated)
- the mean number of users (sessions) to be expected for this stream
output: - the same bg-stream
*/
backgroundStream_t *backgroundStreamInit(backgroundStream_t *stream, double lambda_n){
backgroundStream_t *backgroundStreamInit(backgroundStream_t *stream, double lambda_n)
{
int cnts, numactivenow;
if(stream==0){
stream=(backgroundStream_t*) malloc(sizeof(backgroundStream_t));
if(stream==0) {
stream=(backgroundStream_t*) malloc(sizeof(backgroundStream_t));
}
stream->meanNumSessions=lambda_n;
stream->lastUpdateTime=0;
numactivenow=poisson_dist(lambda_n); /*how many sessions are active (i.e., started before simulation)*/
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++){
if(cnts<numactivenow){
/*these sessions are already active for unknown time and have therefore a random phaseshift in ds*/
stream->activeSessions[cnts].meanSessionRate=backgroundRateRnd();
stream->activeSessions[cnts].endTime=ceil((double)backgroundSessionDurationRnd()*uniform_rng()); /*ms*/
}else{
stream->activeSessions[cnts].meanSessionRate=0;
stream->activeSessions[cnts].endTime=-1;
}
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++) {
if(cnts<numactivenow) {
/*these sessions are already active for unknown time and have therefore a random phaseshift in ds*/
stream->activeSessions[cnts].meanSessionRate=backgroundRateRnd();
stream->activeSessions[cnts].endTime=ceil((double)backgroundSessionDurationRnd()*uniform_rng()); /*ms*/
} else {
stream->activeSessions[cnts].meanSessionRate=0;
stream->activeSessions[cnts].endTime=-1;
}
}
LOG_D(OTG,"BACKGROUND_USERS DEBUG: backgroundStreamInit(%p) called\n", stream);
@@ -489,80 +569,91 @@ backgroundStream_t *backgroundStreamInit(backgroundStream_t *stream, double lamb
return stream;
}
/*
/*
this function updates a given background stream
input: - bg-stream
- current time
output:
input: - bg-stream
- current time
output:
*/
void backgroundUpdateStream(backgroundStream_t *stream, int ctime){
void backgroundUpdateStream(backgroundStream_t *stream, int ctime)
{
int numNewSessions, cnts, period;
LOG_D(OTG,"BACKGROUND DEBUG: backgroundUpdateStream(stream*=%p,ctime=%d) called\n", stream, ctime);
if(stream){
period=ctime-stream->lastUpdateTime;
numNewSessions=poisson_dist(stream->meanNumSessions/5710*period);
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++){
if(stream->activeSessions[cnts].endTime<ctime){
if(numNewSessions>0){
stream->activeSessions[cnts].meanSessionRate=backgroundRateRnd();
stream->activeSessions[cnts].endTime=
ctime-period*uniform_rng()+backgroundSessionDurationRnd(); /*ms*/
numNewSessions--;
}else{
stream->activeSessions[cnts].meanSessionRate=0;
stream->activeSessions[cnts].endTime=-1;
}
}
}
stream->lastUpdateTime=ctime;
backgroundPrintStream (stream);
if(stream) {
period=ctime-stream->lastUpdateTime;
numNewSessions=poisson_dist(stream->meanNumSessions/5710*period);
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++) {
if(stream->activeSessions[cnts].endTime<ctime) {
if(numNewSessions>0) {
stream->activeSessions[cnts].meanSessionRate=backgroundRateRnd();
stream->activeSessions[cnts].endTime=
ctime-period*uniform_rng()+backgroundSessionDurationRnd(); /*ms*/
numNewSessions--;
} else {
stream->activeSessions[cnts].meanSessionRate=0;
stream->activeSessions[cnts].endTime=-1;
}
}
}
stream->lastUpdateTime=ctime;
backgroundPrintStream (stream);
}
}
/*
/*
this function generates the packet size for a given bg-stream and a given idt,
the distribution of the idt can thereby be arbitrary (const idt=20ms recommended)
input: - bg-stream
- current time
- idt of the current packet
output: - packet size of the current packet
the distribution of the idt can thereby be arbitrary (const idt=20ms recommended)
input: - bg-stream
- current time
- idt of the current packet
output: - packet size of the current packet
*/
double backgroundCalculateSize(backgroundStream_t *stream, int ctime, int idt){
double backgroundCalculateSize(backgroundStream_t *stream, int ctime, int idt)
{
int cnts, cntact=0;
double size=0;
double mrate=0;
backgroundUpdateStream(stream, ctime);
LOG_D(OTG,"BACKGROUND DEBUG: backgroundCalculateSize(stream*=%p,idt=%d,ctime=%d) called\n", stream, idt, ctime);
if(stream){
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++){
if(stream->activeSessions[cnts].endTime>ctime){
mrate+=stream->activeSessions[cnts].meanSessionRate;
cntact++;
}
}
size=mrate*idt/1000;
LOG_D(OTG,"BACKGROUND DEBUG: cntact=%02d, idt=%05d, agg_mrate=%05.1f, size=%04.1f\n", cntact, idt, mrate,size);
if(stream) {
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++) {
if(stream->activeSessions[cnts].endTime>ctime) {
mrate+=stream->activeSessions[cnts].meanSessionRate;
cntact++;
}
}
size=mrate*idt/1000;
LOG_D(OTG,"BACKGROUND DEBUG: cntact=%02d, idt=%05d, agg_mrate=%05.1f, size=%04.1f\n", cntact, idt, mrate,size);
}
return size;
}
/*
/*
this function prints the current status of the bg-stream
input: - bg-stream
output:
input: - bg-stream
output:
*/
void backgroundPrintStream(backgroundStream_t *stream){
void backgroundPrintStream(backgroundStream_t *stream)
{
int cnts;
LOG_D(OTG,"BACKGROUND DEBUG: backgroundPrintStream(%p)\n", stream);
if(stream){
if(stream) {
LOG_D(OTG,"BACKGROUND DEBUG: meanNumSessions(lambda_n)=%f\n",stream->meanNumSessions);
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++){
LOG_D(OTG,"BACKGROUND DEBUG: session[%d] -> mrate=%06.3f, etime=%05d\n",
cnts, stream->activeSessions[cnts].meanSessionRate, stream->activeSessions[cnts].endTime);
}
for(cnts=0; cnts<BACKGROUND_NUM_ACTIVE_MAX; cnts++) {
LOG_D(OTG,"BACKGROUND DEBUG: session[%d] -> mrate=%06.3f, etime=%05d\n",
cnts, stream->activeSessions[cnts].meanSessionRate, stream->activeSessions[cnts].endTime);
}
}
}
+2 -2
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_models.h
* \brief Data structure and functions for OTG
* \brief Data structure and functions for OTG
* \author M. Laner and navid nikaein
* \date 2013
* \version 1.0
@@ -39,7 +39,7 @@
*/
#ifndef __OTG_MODELS_H__
# define __OTG_MODELS_H__
# define __OTG_MODELS_H__
+257 -244
View File
@@ -61,7 +61,8 @@ extern unsigned char NB_UE_INST;
// Check if the packet is well received or not and extract data
int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size){
int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
{
int bytes_read=0;
otg_hdr_info_t * otg_hdr_info_rx;
@@ -70,60 +71,63 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
unsigned int seq_num_rx;
unsigned int nb_loss_pkts;
unsigned int lost_packet=0;
if (buffer_tx!=NULL) {
otg_hdr_info_rx = (otg_hdr_info_t *) (&buffer_tx[bytes_read]);
bytes_read += sizeof (otg_hdr_info_t);
LOG_D(OTG,"otg_rx_pkt functions: source %d, destination %d, size %d, otg_hdr_info_rx->flag %.4x, otg_hdr_info_rx->size %d \n",
src,dst,size,otg_hdr_info_rx->flag,otg_hdr_info_rx->size);
if (((otg_hdr_info_rx->flag == 0xffff) ||
(otg_hdr_info_rx->flag == 0xbbbb) ||
(otg_hdr_info_rx->flag == 0x1000)) &&
(otg_hdr_info_rx->size == size )){ //data traffic
(otg_hdr_info_rx->flag == 0xbbbb) ||
(otg_hdr_info_rx->flag == 0x1000)) &&
(otg_hdr_info_rx->size == size )) { //data traffic
LOG_I(OTG,"MAX_RX_INFO %d %d \n",NB_eNB_INST, NB_UE_INST);
/*is_size_ok= 0;
if (( otg_hdr_info_rx->size ) == size ) {*/
if (( otg_hdr_info_rx->size ) == size ) {*/
is_size_ok= 1;
otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]);
LOG_I(OTG,"[SRC %d][DST %d] [FLOW_idx %d][APP TYPE %d] RX INFO pkt at time %d: flag 0x %x, seq number %d, tx time %d, size (hdr %d, pdcp %d) \n", src, dst,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type, ctime, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, otg_hdr_rx->time, otg_hdr_info_rx->size, size);
LOG_I(OTG,"[SRC %d][DST %d] [FLOW_idx %d][APP TYPE %d] RX INFO pkt at time %d: flag 0x %x, seq number %d, tx time %d, size (hdr %d, pdcp %d) \n", src, dst,otg_hdr_rx->flow_id,
otg_hdr_rx->traffic_type, ctime, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, otg_hdr_rx->time, otg_hdr_info_rx->size, size);
bytes_read += sizeof (otg_hdr_t);
if(otg_hdr_rx->traffic_type > MAX_NUM_APPLICATION){
LOG_W(OTG,"RX packet: application type out of range %d for the pair of (src %d, dst %d) \n",
otg_hdr_rx->traffic_type, src, dst);
otg_hdr_rx->traffic_type=0;
if(otg_hdr_rx->traffic_type > MAX_NUM_APPLICATION) {
LOG_W(OTG,"RX packet: application type out of range %d for the pair of (src %d, dst %d) \n",
otg_hdr_rx->traffic_type, src, dst);
otg_hdr_rx->traffic_type=0;
}
/** unicast traffic **/
if (otg_hdr_info_rx->flag == 0xffff){
seq_num_rx=otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type];
if (src<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type];
else
nb_loss_pkts=otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type];
} /** multicast traffic **/
else if (otg_hdr_info_rx->flag == 0x1000){
seq_num_rx = otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type];
nb_loss_pkts = otg_multicast_info->loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type];
// otg_multicast_info->ran_owd[src][dst][otg_hdr_rx->traffic_type] = ctime- otg_hdr_rx->time;
// rx_check_loss(src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts);
// otg_multicast_info->loss_rate[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
//otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
LOG_I(OTG,"received a multicast packet with size %d sn %d ran owd %d loss rate %d\n",
otg_hdr_info_rx->size, seq_num_rx, ctime- otg_hdr_rx->time, nb_loss_pkts);
//return 0;
} /** background traffic **/
else{
seq_num_rx=otg_info->seq_num_rx_background[src][dst];
if (src<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_background_dl[src][dst];
else
nb_loss_pkts=otg_info->nb_loss_pkts_background_ul[src][dst];
/** unicast traffic **/
if (otg_hdr_info_rx->flag == 0xffff) {
seq_num_rx=otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type];
if (src<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type];
else
nb_loss_pkts=otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type];
} /** multicast traffic **/
else if (otg_hdr_info_rx->flag == 0x1000) {
seq_num_rx = otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type];
nb_loss_pkts = otg_multicast_info->loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type];
// otg_multicast_info->ran_owd[src][dst][otg_hdr_rx->traffic_type] = ctime- otg_hdr_rx->time;
// rx_check_loss(src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts);
// otg_multicast_info->loss_rate[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
//otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
LOG_I(OTG,"received a multicast packet with size %d sn %d ran owd %d loss rate %d\n",
otg_hdr_info_rx->size, seq_num_rx, ctime- otg_hdr_rx->time, nb_loss_pkts);
//return 0;
} /** background traffic **/
else {
seq_num_rx=otg_info->seq_num_rx_background[src][dst];
if (src<NB_eNB_INST)
nb_loss_pkts=otg_info->nb_loss_pkts_background_dl[src][dst];
else
nb_loss_pkts=otg_info->nb_loss_pkts_background_ul[src][dst];
}
@@ -135,227 +139,228 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size)
if (otg_info->owd_const[src][dst][otg_hdr_rx->flow_id]==0)
owd_const_gen(src,dst,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type);
owd_const_gen(src,dst,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type);
/******/
/*
float owd_const_capillary_v=owd_const_capillary()/2;
float owd_const_mobile_core_v=owd_const_mobile_core()/2;
float owd_const_IP_backbone_v=owd_const_IP_backbone()/2;
float owd_const_application_v=owd_const_application()/2;
/******/
/*
float owd_const_capillary_v=owd_const_capillary()/2;
float owd_const_mobile_core_v=owd_const_mobile_core()/2;
float owd_const_IP_backbone_v=owd_const_IP_backbone()/2;
float owd_const_application_v=owd_const_application()/2;
FILE *file;
file = fopen("/tmp/log_latency_m2m.txt", "a");
fprintf(file," %d %d [%d] [%d] %.2f %.2f %.2f %.2f %.2f %.2f\n", otg_hdr_rx->time, otg_hdr_info_rx->size, src, dst, owd_const_capillary_v,otg_info->radio_access_delay[src][dst],owd_const_mobile_core_v, owd_const_IP_backbone_v, owd_const_application_v, owd_const_capillary_v + otg_info->radio_access_delay[src][dst]+owd_const_mobile_core_v + owd_const_IP_backbone_v+ owd_const_application_v);
fclose(file);
*/
/******/
// }
FILE *file;
file = fopen("/tmp/log_latency_m2m.txt", "a");
fprintf(file," %d %d [%d] [%d] %.2f %.2f %.2f %.2f %.2f %.2f\n", otg_hdr_rx->time, otg_hdr_info_rx->size, src, dst, owd_const_capillary_v,otg_info->radio_access_delay[src][dst],owd_const_mobile_core_v, owd_const_IP_backbone_v, owd_const_application_v, owd_const_capillary_v + otg_info->radio_access_delay[src][dst]+owd_const_mobile_core_v + owd_const_IP_backbone_v+ owd_const_application_v);
fclose(file);
*/
/******/
// }
if (otg_hdr_rx->time<=ctime){
otg_info->radio_access_delay[src][dst]=(float) (ctime- otg_hdr_rx->time);
otg_multicast_info->radio_access_delay[src][dst]=(float) (ctime- otg_hdr_rx->time);
if (otg_hdr_rx->time<=ctime) {
otg_info->radio_access_delay[src][dst]=(float) (ctime- otg_hdr_rx->time);
otg_multicast_info->radio_access_delay[src][dst]=(float) (ctime- otg_hdr_rx->time);
} else {
LOG_N(OTG,"received packet has tx time %d greater than the current time %d\n",otg_hdr_rx->time,ctime );
otg_info->radio_access_delay[src][dst] = 0;
otg_multicast_info->radio_access_delay[src][dst]=0;
LOG_N(OTG,"received packet has tx time %d greater than the current time %d\n",otg_hdr_rx->time,ctime );
otg_info->radio_access_delay[src][dst] = 0;
otg_multicast_info->radio_access_delay[src][dst]=0;
}
/* actual radio OWD*/
otg_info->rx_pkt_owd[src][dst]=otg_info->radio_access_delay[src][dst];
otg_info->rx_pkt_owd[src][dst]=otg_info->radio_access_delay[src][dst];
/* estimated E2E OWD based on the emulated delays for the other part of the network */
otg_info->rx_pkt_owd_e2e[src][dst]=otg_info->owd_const[src][dst][otg_hdr_rx->flow_id] + otg_info->radio_access_delay[src][dst];
otg_multicast_info->rx_pkt_owd[src][dst]=otg_multicast_info->radio_access_delay[src][dst];
LOG_D(OTG, "[src %d][dst %d] ctime %d tx time %d: OWD %lf E2E OWD %lf \n", src, dst, ctime, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], otg_info->rx_pkt_owd_e2e[src][dst] );
// compute the jitter by ignoring the packet loss
if (lost_packet == 0){
// radio access
otg_info->rx_pkt_owd_history[src][dst][1] = otg_info->rx_pkt_owd_history[src][dst][0]; // the previous owd
otg_info->rx_pkt_owd_history[src][dst][0] = otg_info->rx_pkt_owd[src][dst]; // the current owd
if (otg_info->rx_pkt_owd_history[src][dst][1] == 0) // first packet
otg_info->rx_pkt_jitter[src][dst]=0;
else // for the consecutive packets
LOG_D(OTG, "[src %d][dst %d] ctime %d tx time %d: OWD %lf E2E OWD %lf \n", src, dst, ctime, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], otg_info->rx_pkt_owd_e2e[src][dst] );
// compute the jitter by ignoring the packet loss
if (lost_packet == 0) {
// radio access
otg_info->rx_pkt_owd_history[src][dst][1] = otg_info->rx_pkt_owd_history[src][dst][0]; // the previous owd
otg_info->rx_pkt_owd_history[src][dst][0] = otg_info->rx_pkt_owd[src][dst]; // the current owd
if (otg_info->rx_pkt_owd_history[src][dst][1] == 0) // first packet
otg_info->rx_pkt_jitter[src][dst]=0;
else // for the consecutive packets
otg_info->rx_pkt_jitter[src][dst] = fabsf(otg_info->rx_pkt_owd_history[src][dst][0] - otg_info->rx_pkt_owd_history[src][dst][1]);
LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n",
src, dst, ctime, otg_info->rx_pkt_jitter[src][dst],
otg_info->rx_pkt_owd_history[src][dst][0], otg_info->rx_pkt_owd_history[src][dst][1]);
// e2e
otg_info->rx_pkt_owd_history_e2e[src][dst][1] = otg_info->rx_pkt_owd_history_e2e[src][dst][0]; // the previous owd
otg_info->rx_pkt_owd_history_e2e[src][dst][0] = otg_info->rx_pkt_owd_e2e[src][dst]; // the current owd
if (otg_info->rx_pkt_owd_history_e2e[src][dst][1] == 0) // first packet
otg_info->rx_pkt_jitter_e2e[src][dst]=0;
else // for the consecutive packets
LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n",
src, dst, ctime, otg_info->rx_pkt_jitter[src][dst],
otg_info->rx_pkt_owd_history[src][dst][0], otg_info->rx_pkt_owd_history[src][dst][1]);
// e2e
otg_info->rx_pkt_owd_history_e2e[src][dst][1] = otg_info->rx_pkt_owd_history_e2e[src][dst][0]; // the previous owd
otg_info->rx_pkt_owd_history_e2e[src][dst][0] = otg_info->rx_pkt_owd_e2e[src][dst]; // the current owd
if (otg_info->rx_pkt_owd_history_e2e[src][dst][1] == 0) // first packet
otg_info->rx_pkt_jitter_e2e[src][dst]=0;
else // for the consecutive packets
otg_info->rx_pkt_jitter_e2e[src][dst]= fabsf(otg_info->rx_pkt_owd_history_e2e[src][dst][0] - otg_info->rx_pkt_owd_history_e2e[src][dst][1]);
LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n",
src, dst, ctime, otg_info->rx_pkt_jitter_e2e[src][dst],
otg_info->rx_pkt_owd_history_e2e[src][dst][0], otg_info->rx_pkt_owd_history_e2e[src][dst][1]);
LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n",
src, dst, ctime, otg_info->rx_pkt_jitter_e2e[src][dst],
otg_info->rx_pkt_owd_history_e2e[src][dst][0], otg_info->rx_pkt_owd_history_e2e[src][dst][1]);
}
if (otg_hdr_info_rx->flag == 0x1000){
LOG_I(OTG,"[SRC%d -> DST %d] Received a multicast packet at time %d with size %d, seq num %d, ran owd %d number loss packet %d\n",
dst, src, ctime,otg_hdr_info_rx->size, otg_hdr_rx->seq_num, ctime - otg_hdr_rx->time, nb_loss_pkts);
LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n",
src, dst, otg_multicast_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_multicast_info->rx_pkt_owd[src][dst]);
if (otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0){
otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst];
otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst];
}
else {
otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] );
otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] );
}
if (g_otg->curve==1){
if (g_otg->owd_radio_access==0)
add_tab_metric(src, dst, otg_multicast_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
else
add_tab_metric(src, dst, otg_multicast_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
}
otg_multicast_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
}
else {
if (otg_hdr_info_rx->flag == 0x1000) {
LOG_I(OTG,"[SRC%d -> DST %d] Received a multicast packet at time %d with size %d, seq num %d, ran owd %d number loss packet %d\n",
dst, src, ctime,otg_hdr_info_rx->size, otg_hdr_rx->seq_num, ctime - otg_hdr_rx->time, nb_loss_pkts);
LOG_I(OTG,"[SRC %d][DST %d] Stats :: radio access latency %.2f (tx time %d, ctime %d) jitter %.2f, Estimated E2E OWD:%.2f (ms):\n",
src, dst, otg_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_info->rx_pkt_jitter[src][dst], otg_info->rx_pkt_owd_e2e[src][dst]);
LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n",
src, dst, otg_multicast_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_multicast_info->rx_pkt_owd[src][dst]);
if (otg_hdr_info_rx->flag == 0xffff){
if (otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0) {
otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst];
otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst];
} else {
otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] );
otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] );
}
if (otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0){
otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst];
otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst];
otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src][dst];
otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src][dst];
}
else {
otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] );
otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] );
otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd_e2e[src][dst] );
otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd_e2e[src][dst] );
}
if (g_otg->curve==1) {
if (g_otg->owd_radio_access==0)
add_tab_metric(src, dst, otg_multicast_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
else
add_tab_metric(src, dst, otg_multicast_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
}
if (otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]==0){
otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src][dst];
otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src][dst];
}
else if (lost_packet==0){
otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] );
otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] );
otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter_e2e[src][dst] );
otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter_e2e[src][dst] );
// avg jitter
otg_info->rx_jitter_avg[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_avg_e2e[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter_e2e[src][dst];
otg_info->rx_jitter_sample[src][dst][otg_hdr_rx->traffic_type] +=1;
}
otg_multicast_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
} else {
}
LOG_I(OTG,"[SRC %d][DST %d] Stats :: radio access latency %.2f (tx time %d, ctime %d) jitter %.2f, Estimated E2E OWD:%.2f (ms):\n",
src, dst, otg_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_info->rx_pkt_jitter[src][dst], otg_info->rx_pkt_owd_e2e[src][dst]);
if (g_otg->curve==1){
if (g_otg->owd_radio_access==0)
add_tab_metric(src, dst, otg_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
else
add_tab_metric(src, dst, otg_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
}
if (otg_hdr_info_rx->flag == 0xffff) {
if (src<NB_eNB_INST)
otg_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
else
otg_info->rx_total_bytes_ul+=otg_hdr_info_rx->size;
if (otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0) {
otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst];
otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst];
otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src][dst];
otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd_e2e[src][dst];
} else {
otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] );
otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] );
otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd_e2e[src][dst] );
otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd_e2e[src][dst] );
}
if (otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]==0) {
otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src][dst];
otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter_e2e[src][dst];
} else if (lost_packet==0) {
otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] );
otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] );
otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter_e2e[src][dst] );
otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min_e2e[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter_e2e[src][dst] );
// avg jitter
otg_info->rx_jitter_avg[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter[src][dst];
otg_info->rx_jitter_avg_e2e[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter_e2e[src][dst];
otg_info->rx_jitter_sample[src][dst][otg_hdr_rx->traffic_type] +=1;
}
}
if (g_otg->curve==1) {
if (g_otg->owd_radio_access==0)
add_tab_metric(src, dst, otg_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
else
add_tab_metric(src, dst, otg_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time);
}
if (src<NB_eNB_INST)
otg_info->rx_total_bytes_dl+=otg_hdr_info_rx->size;
else
otg_info->rx_total_bytes_ul+=otg_hdr_info_rx->size;
}
//LOG_I(OTG,"RX INFO :: RTT MIN(one way) ms: %.2f, RTT MAX(one way) ms: %.2f \n", otg_info->rx_owd_min[src][dst], otg_info->rx_owd_max[src][dst]);
/* xforms part: add metrics */
//printf("payload_size %d, header_size %d \n", otg_hdr_rx->pkts_size, otg_hdr_rx->hdr_type);
LOG_I(OTG,"[RX] OTG packet, PACKET SIZE [SRC %d][DST %d]: Flag (0x%x), Traffic %d, time(%d), Seq num (%d), Total size (%d)\n",
src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->traffic_type, ctime, otg_hdr_rx->seq_num, size);
LOG_I(OTG,"[RX] OTG packet, PACKET SIZE [SRC %d][DST %d]: Flag (0x%x), Traffic %d, time(%d), Seq num (%d), Total size (%d)\n",
src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->traffic_type, ctime, otg_hdr_rx->seq_num, size);
/*LOG_I(OTG,"details::RX [SRC %d][DST %d]: Flag (0x%x), time(%d), Seq num (%d), Total size (%d), header(%d), payload (%d) \n", src, dst, otg_hdr_info_rx->flag, ctime, otg_hdr_rx->seq_num, size, strlen(packet_rx->header), strlen(packet_rx->payload));*/
if (otg_hdr_info_rx->flag == 0xffff){
otg_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1;
otg_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
if (otg_hdr_info_rx->flag == 0xffff) {
otg_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1;
otg_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
if (src<NB_eNB_INST)
otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
else
otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
if (src<NB_eNB_INST)
otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
else
otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
/*Plots of latency and goodput are only plotted for the data traffic*/
/*measurements are done for the data and background traffic */
/*Plots of latency and goodput are only plotted for the data traffic*/
/*measurements are done for the data and background traffic */
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0){
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY);
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter_e2e[src][dst], OTG_JITTER);
} else {
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY);
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter[src][dst], OTG_JITTER);
}
}
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0) {
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY);
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter_e2e[src][dst], OTG_JITTER);
} else {
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY);
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter[src][dst], OTG_JITTER);
}
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */
}
else if (otg_hdr_info_rx->flag == 0x1000){
otg_multicast_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1;
otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
// LOG_D(OTG,"DUY: otg_multicast_info->rx_num_bytes[%d][%d][%d] is %d \nn",src,dst,otg_hdr_rx->traffic_type,otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]);
otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
otg_multicast_info->loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
} else if (otg_hdr_info_rx->flag == 0x1000) {
otg_multicast_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1;
otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size;
// LOG_D(OTG,"DUY: otg_multicast_info->rx_num_bytes[%d][%d][%d] is %d \nn",src,dst,otg_hdr_rx->traffic_type,otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]);
otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx;
otg_multicast_info->loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts;
/*Plots of latency and goodput are only plotted for the data traffic*/
/*measurements are done for the data and background traffic */
/*Plots of latency and goodput are only plotted for the data traffic*/
/*measurements are done for the data and background traffic */
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0)
add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->rx_pkt_owd[src][dst], OTG_LATENCY);
else
add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->radio_access_delay[src][dst], OTG_LATENCY);
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */
}
else{
otg_info->rx_num_pkt_background[src][dst]+=1;
otg_info->rx_num_bytes_background[src][dst]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx_background[src][dst]=seq_num_rx;
if (src<NB_eNB_INST)
otg_info->nb_loss_pkts_background_dl[src][dst]=nb_loss_pkts;
else
otg_info->nb_loss_pkts_background_ul[src][dst]=nb_loss_pkts;
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0)
add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->rx_pkt_owd[src][dst], OTG_LATENCY);
else
add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->radio_access_delay[src][dst], OTG_LATENCY);
}
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0)
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY_BG);
else
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY_BG);
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP_BG);
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */
} else {
otg_info->rx_num_pkt_background[src][dst]+=1;
otg_info->rx_num_bytes_background[src][dst]+=otg_hdr_info_rx->size;
otg_info->seq_num_rx_background[src][dst]=seq_num_rx;
if (src<NB_eNB_INST)
otg_info->nb_loss_pkts_background_dl[src][dst]=nb_loss_pkts;
else
otg_info->nb_loss_pkts_background_ul[src][dst]=nb_loss_pkts;
if (g_otg->latency_metric) {
if (g_otg->owd_radio_access==0)
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY_BG);
else
add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY_BG);
}
if (g_otg->throughput_metric)
add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP_BG);
}
if (is_size_ok == 0) {
otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]);
LOG_W(OTG,"[SRC %d][DST %d] RX pkt: seq number %d size mis-matche (hdr %d, pdcp %d) \n", src, dst, otg_hdr_rx->seq_num, otg_hdr_info_rx->size, size);
otg_info->nb_loss_pkts_otg[src][dst]++;
otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]);
LOG_W(OTG,"[SRC %d][DST %d] RX pkt: seq number %d size mis-matche (hdr %d, pdcp %d) \n", src, dst, otg_hdr_rx->seq_num, otg_hdr_info_rx->size, size);
otg_info->nb_loss_pkts_otg[src][dst]++;
}
return(0);
} else{
} else {
LOG_W(OTG,"RX: Not an OTG pkt, forward to upper layer (flag %x, size %d, pdcp_size %d) FIX ME \n", otg_hdr_info_rx->flag, otg_hdr_info_rx->size, size);
return(0); //to be fixed on the real case to one
}
@@ -368,92 +373,100 @@ float owd_const_application_v=owd_const_application()/2;
int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx, unsigned int *nb_loss_pkts){
int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx, unsigned int *nb_loss_pkts)
{
/* Loss and out of sequence data management, we have 3 case : */
/* (1) Receieved packet corresponds to the expected one, in terms of the sequence number*/
int lost_packet=0;
if (seq_num==*seq_num_rx) {
LOG_D(OTG,"check_packet :: (src=%d,dst=%d, flag=0x%x) packet seq_num TX=%d, seq_num RX=%d \n",src,dst,flag, seq_num, *seq_num_rx);
*seq_num_rx+=1;
}
/* (2) Receieved packet with a sequence number higher than the expected sequence number (there is a gap): packet loss */
else if (seq_num>*seq_num_rx){ // out of sequence packet: previous packet lost
else if (seq_num>*seq_num_rx) { // out of sequence packet: previous packet lost
LOG_D(OTG,"check_packet :: (src=%d,dst=%d, flag=0x%x) :: out of sequence :: packet seq_num TX=%d > seq_num RX=%d \n",src,dst,flag, seq_num, *seq_num_rx);
*nb_loss_pkts+=seq_num-(*seq_num_rx);
*seq_num_rx=seq_num+1;
lost_packet=1;
}
/* (3) Receieved packet with a sequence number less than the expected sequence number: recovery after loss/out of sequence */
else if (seq_num< *seq_num_rx){ //the received packet arrived late
else if (seq_num< *seq_num_rx) { //the received packet arrived late
*nb_loss_pkts-=1;
LOG_D(OTG,"check_packet :: (src=%d,dst=%d, flag=0x%x) :: recovery after loss or out of sequence :: packet seq_num TX=%d < seq_num RX=%d \n",src,dst,flag, seq_num, *seq_num_rx);
}
else {
} else {
LOG_D(OTG,"check_packet :: (src=%d,dst=%d, flag=0x%x) :: packet seq_num TX=%d , seq_num RX=%d (ERROR)\n",src,dst,flag, seq_num, *seq_num_rx);
lost_packet=1;
}
return lost_packet;
}
void owd_const_gen(int src, int dst, int flow_id, unsigned int flag){
void owd_const_gen(int src, int dst, int flow_id, unsigned int flag)
{
otg_info->owd_const[src][dst][flow_id]=(owd_const_mobile_core()+owd_const_IP_backbone()+owd_const_application())/2;
if ((flag==M2M)||(flag==M2M_TRAFFIC)||(flag==AUTO_PILOT_L)||(flag==AUTO_PILOT_M)||(flag==AUTO_PILOT_H)||(flag==VIRTUAL_GAME_L)||(flag==VIRTUAL_GAME_M)|| (flag==VIRTUAL_GAME_H)||(flag==VIRTUAL_GAME_F)||(flag==ALARM_HUMIDITY)||(flag==ALARM_SMOKE)||(flag==ALARM_TEMPERATURE)||(flag==OPENARENA)||(flag==IQSIM_MANGO)||(flag==IQSIM_NEWSTEO)) {
if ((flag==M2M)||(flag==M2M_TRAFFIC)||(flag==AUTO_PILOT_L)||(flag==AUTO_PILOT_M)||(flag==AUTO_PILOT_H)||(flag==VIRTUAL_GAME_L)||(flag==VIRTUAL_GAME_M)|| (flag==VIRTUAL_GAME_H)||(flag==VIRTUAL_GAME_F)
||(flag==ALARM_HUMIDITY)||(flag==ALARM_SMOKE)||(flag==ALARM_TEMPERATURE)||(flag==OPENARENA)||(flag==IQSIM_MANGO)||(flag==IQSIM_NEWSTEO)) {
otg_info->owd_const[src][dst][flow_id]+=(owd_const_capillary()/2);
LOG_D(OTG,"(RX) [src %d] [dst %d] [ID %d] TRAFFIC_TYPE IS M2M [Add Capillary const]\n", src, dst, flow_id);
}
else
} else
LOG_T(OTG,"(RX) [src %d] [dst %d] [ID %d] TRAFFIC_TYPE WITHOUT M2M [Capillary const]\n", src, dst, flow_id);
}
float owd_const_capillary(void){
float owd_const_capillary(void)
{
/*return (uniform_dist(MIN_APPLICATION_PROCESSING_GATEWAY_DELAY, MAX_APPLICATION_PROCESSING_GATEWAY_DELAY) +
uniform_dist(MIN_FORMATING_TRANSFERRING_DELAY, MAX_FORMATING_TRANSFERRING_DELAY) +
uniform_dist(MIN_ACCESS_DELAY, MAX_ACCESS_DELAY) +
TERMINAL_ACCESS_DELAY);*/
return ((double)MIN_APPLICATION_PROCESSING_GATEWAY_DELAY+ (double)MAX_APPLICATION_PROCESSING_GATEWAY_DELAY + (double)MIN_FORMATING_TRANSFERRING_DELAY+ (double)MAX_FORMATING_TRANSFERRING_DELAY+ (double)MIN_ACCESS_DELAY+(double)MAX_ACCESS_DELAY) /2 + (double)TERMINAL_ACCESS_DELAY;
uniform_dist(MIN_FORMATING_TRANSFERRING_DELAY, MAX_FORMATING_TRANSFERRING_DELAY) +
uniform_dist(MIN_ACCESS_DELAY, MAX_ACCESS_DELAY) +
TERMINAL_ACCESS_DELAY);*/
return ((double)MIN_APPLICATION_PROCESSING_GATEWAY_DELAY+ (double)MAX_APPLICATION_PROCESSING_GATEWAY_DELAY + (double)MIN_FORMATING_TRANSFERRING_DELAY+ (double)MAX_FORMATING_TRANSFERRING_DELAY+
(double)MIN_ACCESS_DELAY+(double)MAX_ACCESS_DELAY) /2 + (double)TERMINAL_ACCESS_DELAY;
}
float owd_const_mobile_core(void){
float owd_const_mobile_core(void)
{
/*double delay;
// this is a delay model for a loaded GGSN according to
//"M. Laner, P. Svoboda and M. Rupp, Latency Analysis of 3G Network Components, EW'12, Poznan, Poland, 2012", table 2, page 6.
//"M. Laner, P. Svoboda and M. Rupp, Latency Analysis of 3G Network Components, EW'12, Poznan, Poland, 2012", table 2, page 6.
if(uniform_rng ()<0.3){
delay=uniform_dist (0.4,1.2);
delay=uniform_dist (0.4,1.2);
}else{
// in this case, according to the fit in the paper,
// the delay is generalized pareto: GP(k=0.75,s=0.55,t=1.2)
// using inverse cdf method we have CDF(x)=1-(k(x-t)/s+1)^(-1/k),
// x=CDF^(-1)(u)=t+s/k*((1-u)^(-k)-1) , hence when u~uniform, than x~GP(k,s,t)
// in this case, according to the fit in the paper,
// the delay is generalized pareto: GP(k=0.75,s=0.55,t=1.2)
// using inverse cdf method we have CDF(x)=1-(k(x-t)/s+1)^(-1/k),
// x=CDF^(-1)(u)=t+s/k*((1-u)^(-k)-1) , hence when u~uniform, than x~GP(k,s,t)
double k,s,t,u;
k=0.75;
s=0.55;
t=1.2;
u=uniform_rng();
delay= t + s/k*(pow(1-u,-k)-1);
double k,s,t,u;
k=0.75;
s=0.55;
t=1.2;
u=uniform_rng();
delay= t + s/k*(pow(1-u,-k)-1);
}
return delay; */
/*return ( uniform_dist(MIN_U_PLANE_CORE_IP_ACCESS_DELAY, MAX_U_PLANE_CORE_IP_ACCESS_DELAY) + uniform_dist(MIN_FW_PROXY_DELAY,MAX_FW_PROXY_DELAY)); */
return ((double)MIN_U_PLANE_CORE_IP_ACCESS_DELAY+ (double)MAX_U_PLANE_CORE_IP_ACCESS_DELAY + (double)MIN_FW_PROXY_DELAY + (double)MAX_FW_PROXY_DELAY)/2;
}
float owd_const_IP_backbone(void){
float owd_const_IP_backbone(void)
{
/*return uniform_dist(MIN_NETWORK_ACCESS_DELAY,MAX_NETWORK_ACCESS_DELAY);*/
return ((double)MIN_NETWORK_ACCESS_DELAY+(double)MAX_NETWORK_ACCESS_DELAY)/2;
return ((double)MIN_NETWORK_ACCESS_DELAY+(double)MAX_NETWORK_ACCESS_DELAY)/2;
}
float owd_const_application(void){
float owd_const_application(void)
{
/*return uniform_dist(MIN_APPLICATION_ACESS_DELAY, MAX_APPLICATION_ACESS_DELAY);*/
return ((double)MIN_APPLICATION_ACESS_DELAY+(double)MAX_APPLICATION_ACESS_DELAY)/2;
return ((double)MIN_APPLICATION_ACESS_DELAY+(double)MAX_APPLICATION_ACESS_DELAY)/2;
}
+14 -14
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_rx.h
* \brief Data structure and functions for OTG receiver
* \brief Data structure and functions for OTG receiver
* \author navid nikaein A. Hafsaoui
* \date 2011
* \version 1.0
@@ -40,7 +40,7 @@
#ifndef __OTG_RX_H__
# define __OTG_RX_H__
# define __OTG_RX_H__
#include <unistd.h>
#include <stdio.h>
@@ -54,12 +54,12 @@
/*! \fn char *check_packet(int src, int dst, int ctime);
* \brief check if the packet is well received and do measurements: one way delay, throughput,etc.
* \param[in] the source
* \param[in] the destination
* \brief check if the packet is well received and do measurements: one way delay, throughput,etc.
* \param[in] the source
* \param[in] the destination
* \param[in] time of the emulation
* \param[out] return NULL is the packet is well received, else the packet to forward
* \note
* \note
* @ingroup _otg
*/
int otg_rx_pkt(int src, int dst, int ctime, char *packet, unsigned int size);
@@ -67,10 +67,10 @@ int otg_rx_pkt(int src, int dst, int ctime, char *packet, unsigned int size);
/*! \fn void owd_const_gen(int src,int dst);
*\brief compute the one way delay introduced in LTE/LTE-A network REF PAPER: "Latency for Real-Time Machine-to-Machine Communication in LTE-Based System Architecture"
*\param[in] the source
*\param[in] the source
*\param[in] the destination
*\param[out] void
*\note
*\note
*@ingroup _otg
*/
void owd_const_gen(int src,int dst, int flow_id, unsigned int flag);
@@ -78,7 +78,7 @@ void owd_const_gen(int src,int dst, int flow_id, unsigned int flag);
/*! \fn float owd_const_capillary();
*\brief compute the one way delay introduced in LTE/LTE-A network REF PAPER: "Latency for Real-Time Machine-to-Machine Communication in LTE-Based System Architecture"
*\param[out] float: capillary delay constant
*\note
*\note
*@ingroup _otg
*/
float owd_const_capillary(void);
@@ -86,7 +86,7 @@ float owd_const_capillary(void);
/*! \fn float owd_const_mobile_core();
*\brief compute the one way delay introduced in LTE/LTE-A network REF PAPER: "Latency for Real-Time Machine-to-Machine Communication in LTE-Based System Architecture"
*\param[out] float: mobile core delay constant
*\note
*\note
*@ingroup _otg
*/
float owd_const_mobile_core(void);
@@ -94,7 +94,7 @@ float owd_const_mobile_core(void);
/*! \fn float owd_const_IP_backbone();
*\brief compute the one way delay introduced in LTE/LTE-A network REF PAPER: "Latency for Real-Time Machine-to-Machine Communication in LTE-Based System Architecture"
*\param[out] float: IP backbone delay constant
*\note
*\note
*@ingroup _otg
*/
float owd_const_IP_backbone(void);
@@ -102,7 +102,7 @@ float owd_const_IP_backbone(void);
/*! \fn float owd_const_applicatione();
*\brief compute the one way delay introduced in LTE/LTE-A network REF PAPER: "Latency for Real-Time Machine-to-Machine Communication in LTE-Based System Architecture"
*\param[out] float: application delay constant
*\note
*\note
*@ingroup _otg
*/
float owd_const_application(void);
@@ -115,9 +115,9 @@ float owd_const_application(void);
*\param[in] flag: background or data
*\param[in] seq_num: packet sequence number
*\param[in] seq_num_rx:RX sequence number
*\param[in] nb_loss_pkts: number of lost packet
*\param[in] nb_loss_pkts: number of lost packet
*\param[out] lost_packet: (0) no lost packets, (1) lost packets
*\note
*\note
*@ingroup _otg
*/
int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx, unsigned int *nb_loss_pkts);
+170 -174
View File
@@ -45,7 +45,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -79,48 +79,50 @@
typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr SOCKADDR;
void *recv_ip4_tcp(void* csock)
{
int sock_rcv;
int socket=(int)csock;
char buffer[PAYLOAD_MAX];
int sock_rcv;
int socket=(int)csock;
char buffer[PAYLOAD_MAX];
int i=0;
do{
int i=0;
do {
sock_rcv=recv(socket, buffer, PAYLOAD_MAX, 0);
if ((buffer!=NULL)&& (strlen(buffer)>0)) {
// payload_t* payload;
// payload->control_hdr = (control_hdr_t*) malloc (sizeof(control_hdr_t));
// payload->payload_rest = (char *) malloc (sock_rcv - sizeof(control_hdr_t));
// memcpy (payload->control_hdr, buffer, sizeof(control_hdr_t));
// memcpy (payload->payload_rest , buffer+sizeof(control_hdr_t), (sock_rcv - sizeof(control_hdr_t)));
// LOG_I(OTG,"SOCKET:: UDP-IP4 :: SRC=%d, DST=%d, PROTO=%d, IP VERSION=%d\n", payload->control_hdr->src,payload->control_hdr->dst, payload->control_hdr->trans_proto, payload->control_hdr->ip_v);
sock_rcv=recv(socket, buffer, PAYLOAD_MAX, 0);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: size=%d received=%d, Received buffer: %s \n\n\n", strlen(buffer), sock_rcv, buffer);
buffer[PAYLOAD_MAX] != '\0';
}
if ((buffer!=NULL)&& (strlen(buffer)>0)) {
// payload_t* payload;
// payload->control_hdr = (control_hdr_t*) malloc (sizeof(control_hdr_t));
// payload->payload_rest = (char *) malloc (sock_rcv - sizeof(control_hdr_t));
// memcpy (payload->control_hdr, buffer, sizeof(control_hdr_t));
// memcpy (payload->payload_rest , buffer+sizeof(control_hdr_t), (sock_rcv - sizeof(control_hdr_t)));
// LOG_I(OTG,"SOCKET:: UDP-IP4 :: SRC=%d, DST=%d, PROTO=%d, IP VERSION=%d\n", payload->control_hdr->src,payload->control_hdr->dst, payload->control_hdr->trans_proto, payload->control_hdr->ip_v);
}while(sock_rcv !=-1);;
LOG_I(OTG,"SOCKET:: TCP-IP4 :: size %d \n ", i) ;
LOG_I(OTG,"SOCKET:: TCP-IP4 :: size=%d received=%d, Received buffer: %s \n\n\n", strlen(buffer), sock_rcv, buffer);
buffer[PAYLOAD_MAX] != '\0';
}
close(socket);
pthread_exit(NULL);
} while(sock_rcv !=-1);;
LOG_I(OTG,"SOCKET:: TCP-IP4 :: size %d \n ", i) ;
return NULL;
close(socket);
pthread_exit(NULL);
return NULL;
}
@@ -129,8 +131,8 @@ return NULL;
void server_socket_tcp_ip4()
{
#if defined (WIN32)
#include <winsock2.h>
typedef int socklen_t;
#include <winsock2.h>
typedef int socklen_t;
#elif defined (linux)
#endif
@@ -138,99 +140,92 @@ void server_socket_tcp_ip4()
#if defined (WIN32)
WSADATA WSAData;
int erreur = WSAStartup(MAKEWORD(2,2), &WSAData);
#else
int erreur = 0;
#endif
WSADATA WSAData;
int erreur = WSAStartup(MAKEWORD(2,2), &WSAData);
#else
int erreur = 0;
#endif
SOCKADDR_IN sin;
int sock;
int recsize = sizeof sin;
SOCKADDR_IN sin;
int sock;
int recsize = sizeof sin;
int sock_err, sock_rcv;
int sock_err, sock_rcv;
if(!erreur)
{
sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock != INVALID_SOCKET)
{
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Socket number= %d is opend using TCP and IPv4\n", sock);
if(!erreur) {
sock = socket(AF_INET, SOCK_STREAM, 0);
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_family = AF_INET;
sin.sin_port = htons(PORT);
sock_err = bind(sock, (SOCKADDR*) &sin, recsize);
if(sock != INVALID_SOCKET) {
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Socket number= %d is opend using TCP and IPv4\n", sock);
if(sock_err != SOCKET_ERROR)
{
sock_err = listen(sock, 5);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Port Open %d...\n", PORT);
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_family = AF_INET;
sin.sin_port = htons(PORT);
sock_err = bind(sock, (SOCKADDR*) &sin, recsize);
if(sock_err != SOCKET_ERROR)
{
int cmpt_cl=1;
if(sock_err != SOCKET_ERROR) {
sock_err = listen(sock, 5);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Port Open %d...\n", PORT);
/* Creation of the set of reading */
fd_set readfs;
if(sock_err != SOCKET_ERROR) {
int cmpt_cl=1;
while(1)
{
/* Creation of the set of reading */
fd_set readfs;
int csock; /* conncted socket */
pthread_t id; /* thread that manage the opened connection */
while(1) {
int csock; /* conncted socket */
pthread_t id; /* thread that manage the opened connection */
/* Empty the set of reading and add the server to the socket */
FD_ZERO(&readfs);
FD_SET(sock, &readfs);
/* Empty the set of reading and add the server to the socket */
FD_ZERO(&readfs);
FD_SET(sock, &readfs);
/* If an error occurred at the select */
if(select(sock + 1, &readfs, NULL, NULL, NULL) < 0)
{
perror("select()");
exit(errno);
}
/* check if the socket server provides information to read */
if(FD_ISSET(sock, &readfs))
{
/* the server socket necessarily means that a client wants to connect to the server*/
SOCKADDR_IN csin;
int crecsize = sizeof csin;
csock = accept(sock, (SOCKADDR *) &csin, &crecsize);
/* create new thread for the new connection */
if (pthread_create(&id, NULL, (void *)recv_ip4_tcp, (void*)csock))
LOG_W(OTG,"SOCKET:: TCP-IP4 ::pthread_create OK!\n");
else
LOG_W(OTG,"SOCKET:: TCP-IP4 ::Error in pthread_create \n");
if (pthread_detach(id))
LOG_W(OTG,"SOCKET:: TCP-IP4 ::pthread_detach OK!\n");
else
LOG_W(OTG,"SOCKET:: TCP-IP4 ::Error in pthread_detach\n");
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Client n=%d finish transmission\n", cmpt_cl);
cmpt_cl+=1;
}
}
}
/* If an error occurred at the select */
if(select(sock + 1, &readfs, NULL, NULL, NULL) < 0) {
perror("select()");
exit(errno);
}
}
}
#if defined (WIN32)
WSACleanup();
#endif
/* check if the socket server provides information to read */
if(FD_ISSET(sock, &readfs)) {
/* the server socket necessarily means that a client wants to connect to the server*/
SOCKADDR_IN csin;
int crecsize = sizeof csin;
csock = accept(sock, (SOCKADDR *) &csin, &crecsize);
/* create new thread for the new connection */
if (pthread_create(&id, NULL, (void *)recv_ip4_tcp, (void*)csock))
LOG_W(OTG,"SOCKET:: TCP-IP4 ::pthread_create OK!\n");
else
LOG_W(OTG,"SOCKET:: TCP-IP4 ::Error in pthread_create \n");
if (pthread_detach(id))
LOG_W(OTG,"SOCKET:: TCP-IP4 ::pthread_detach OK!\n");
else
LOG_W(OTG,"SOCKET:: TCP-IP4 ::Error in pthread_detach\n");
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Client n=%d finish transmission\n", cmpt_cl);
cmpt_cl+=1;
}
}
}
}
}
}
#if defined (WIN32)
WSACleanup();
#endif
}
@@ -239,7 +234,7 @@ void server_socket_udp_ip4()
{
int sockfd, bytes_recv, addr_in_size, cmpt_cl=1;
int sockfd, bytes_recv, addr_in_size, cmpt_cl=1;
u_short portnum = 12345;
struct sockaddr_in *my_addr, *from;
char msg[PAYLOAD_MAX];
@@ -256,50 +251,51 @@ int sockfd, bytes_recv, addr_in_size, cmpt_cl=1;
my_addr->sin_addr.s_addr = htonl(INADDR_ANY);
my_addr->sin_port = portnum;
if((sockfd = socket (PF_INET, SOCK_DGRAM, 0)) < 0){
if((sockfd = socket (PF_INET, SOCK_DGRAM, 0)) < 0) {
LOG_W(OTG,"SOCKET:: UDP-IP4 :: Error %d in socket: %s\n",errno,sys_errlist[errno]);
exit(errno);
};
if(bind(sockfd, (struct sockaddr *)my_addr, addr_in_size) < 0){
if(bind(sockfd, (struct sockaddr *)my_addr, addr_in_size) < 0) {
LOG_W(OTG,"SOCKET:: UDP-IP4 :: Error %d in bind: %s\n",errno,sys_errlist[errno]);
if(errno != EADDRINUSE) exit(errno);
};
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Ready to receive UDP traffic\n");
do{
do {
bytes_recv = recvfrom (sockfd,msg,PAYLOAD_MAX,0,(struct sockaddr *)from, &addr_in_size);
if (bytes_recv>0) {
payload_t* payload;
payload->control_hdr = (control_hdr_t*) malloc (sizeof(control_hdr_t));
payload->payload_rest = (char *) malloc (bytes_recv - sizeof(control_hdr_t));
memcpy (payload->control_hdr, msg, sizeof(control_hdr_t));
memcpy (payload->payload_rest , msg+sizeof(control_hdr_t), (bytes_recv - sizeof(control_hdr_t)));
if (bytes_recv>0) {
payload_t* payload;
payload->control_hdr = (control_hdr_t*) malloc (sizeof(control_hdr_t));
payload->payload_rest = (char *) malloc (bytes_recv - sizeof(control_hdr_t));
memcpy (payload->control_hdr, msg, sizeof(control_hdr_t));
memcpy (payload->payload_rest , msg+sizeof(control_hdr_t), (bytes_recv - sizeof(control_hdr_t)));
LOG_I(OTG,"SOCKET:: UDP-IP4 :: SRC=%d, DST=%d, PROTO=%d, IP VERSION=%d\n", payload->control_hdr->src,payload->control_hdr->dst, payload->control_hdr->trans_proto, payload->control_hdr->ip_v);
fromaddr = from->sin_addr.s_addr;
LOG_I(OTG,"SOCKET:: UDP-IP4 :: SRC=%d, DST=%d, PROTO=%d, IP VERSION=%d\n", payload->control_hdr->src,payload->control_hdr->dst, payload->control_hdr->trans_proto, payload->control_hdr->ip_v);
fromaddr = from->sin_addr.s_addr;
// Update RX OTG info
//otg_info->rx_num_pkt[payload->control_hdr->src][payload->control_hdr->dst]+=1;
//otg_info->rx_num_bytes[payload->control_hdr->src][payload->control_hdr->dst]+= bytes_recv + (HDR_IP_v4 + HDR_UDP);
//
// Update RX OTG info
//otg_info->rx_num_pkt[payload->control_hdr->src][payload->control_hdr->dst]+=1;
//otg_info->rx_num_bytes[payload->control_hdr->src][payload->control_hdr->dst]+= bytes_recv + (HDR_IP_v4 + HDR_UDP);
//
LOG_I(OTG,"SOCKET:: UDP-IP4 :: From=%s , port= %d, data= , bytes NB=%d\n", (gethostbyaddr((char *)&fromaddr, sizeof(fromaddr), AF_INET))->h_name, from->sin_port, bytes_recv);
}
}while(bytes_recv !=-1);
LOG_I(OTG,"SOCKET:: UDP-IP4 :: From=%s , port= %d, data= , bytes NB=%d\n", (gethostbyaddr((char *)&fromaddr, sizeof(fromaddr), AF_INET))->h_name, from->sin_port, bytes_recv);
}
close(sockfd);
} while(bytes_recv !=-1);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Client n=%d finish transmission\n", cmpt_cl);
cmpt_cl+=1;
close(sockfd);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Client n=%d finish transmission\n", cmpt_cl);
cmpt_cl+=1;
}
@@ -307,55 +303,55 @@ int sockfd, bytes_recv, addr_in_size, cmpt_cl=1;
int main (int argc, char **argv){
int main (int argc, char **argv)
{
int i;
char *protocol=NULL;
char *ip_version=NULL;
int i;
char *protocol=NULL;
char *ip_version=NULL;
for (i = 1; i <argc ; i ++){
if ('-' == argv[i][0]) {
if(('h' == argv[i][1]) || ('H' == argv[i][1])) {
printf("Help OTG RX: \n. ./server [-P (protocol: TCP or UDP)] [-I (ip version: IP4 or IP6)]\n");
return(0);
}
for (i = 1; i <argc ; i ++) {
if ('-' == argv[i][0]) {
else if ('P' == argv[i][1]) {
protocol=argv[i+1];
if ((strcmp(argv[i+1],"TCP")==0) || (strcmp(argv[i+1],"UDP")==0) || (strcmp(argv[i+1],"tcp")==0) || (strcmp(argv[i+1],"udp")==0))
{
protocol=argv[i+1];
printf("Protocol=%s\n", protocol);
}
}
if(('h' == argv[i][1]) || ('H' == argv[i][1])) {
printf("Help OTG RX: \n. ./server [-P (protocol: TCP or UDP)] [-I (ip version: IP4 or IP6)]\n");
return(0);
else if ('I' == argv[i][1]) {
if ((strcmp(argv[i+1],"IP4")==0) || (strcmp(argv[i+1],"IP6")==0) || (strcmp(argv[i+1],"ip4")==0) || (strcmp(argv[i+1],"ip6")==0))
{
ip_version=argv[i+1];
printf("IP version=%s\n", ip_version);
}
}
else if ('P' == argv[i][1]) {
protocol=argv[i+1];
if ((strcmp(argv[i+1],"TCP")==0) || (strcmp(argv[i+1],"UDP")==0) || (strcmp(argv[i+1],"tcp")==0) || (strcmp(argv[i+1],"udp")==0)) {
protocol=argv[i+1];
printf("Protocol=%s\n", protocol);
}
}
else if ('I' == argv[i][1]) {
if ((strcmp(argv[i+1],"IP4")==0) || (strcmp(argv[i+1],"IP6")==0) || (strcmp(argv[i+1],"ip4")==0) || (strcmp(argv[i+1],"ip6")==0)) {
ip_version=argv[i+1];
printf("IP version=%s\n", ip_version);
}
}
}
}
//Select the server to use
if ((ip_version !=NULL) && (protocol!=NULL)) {
if (((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0)) && ((strcmp(protocol,"TCP")==0) ||(strcmp(protocol,"tcp")==0)))
server_socket_tcp_ip4();
else if (((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0)) && ((strcmp(protocol,"UDP")==0) ||(strcmp(protocol,"udp")==0)))
server_socket_udp_ip4();
}
return 0;
}
}
}
//Select the server to use
if ((ip_version !=NULL) && (protocol!=NULL)) {
if (((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0)) && ((strcmp(protocol,"TCP")==0) ||(strcmp(protocol,"tcp")==0)))
server_socket_tcp_ip4();
else if (((strcmp(ip_version,"IP4")==0) ||(strcmp(ip_version,"ip4")==0)) && ((strcmp(protocol,"UDP")==0) ||(strcmp(protocol,"udp")==0)))
server_socket_udp_ip4();
}
return 0;
}
+4 -4
View File
@@ -47,10 +47,10 @@
/*! \fn server_socket_tcp_ip4()
* \brief this function allow to run a server dedicated to IP v4 and TCP traffic .
* \param[in]
* \param[out]
* \return void
* \note
* \param[in]
* \param[out]
* \return void
* \note
* @ingroup _otg
*/
void server_socket_tcp_ip4();
+1606 -1445
View File
File diff suppressed because it is too large Load Diff
+39 -38
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_tx.h
* \brief Data structure and functions for OTG
* \brief Data structure and functions for OTG
* \author N. Nikaein and A. Hafsaoui
* \date 2011
* \version 1.0
@@ -39,7 +39,7 @@
*/
#ifndef __OTG_TX_H__
# define __OTG_TX_H__
# define __OTG_TX_H__
@@ -57,28 +57,28 @@
/*! \fn int time_dist(int src, int dst, int state)
* \brief compute Inter Departure Time, in ms
* \param[in] Source, destination, state
* \param[out] Inter Departure Time
* \note
* \param[out] Inter Departure Time
* \note
* @ingroup _otg
*/
int time_dist(int src, int dst, int application, int state);
/*! \fn int size_dist(int src, int dst, int state)
* \brief compute the payload size, in bytes
* \brief compute the payload size, in bytes
* \param[in] Source, node_dst, state
* \param[out] size of the payload, in bytes
* \note
* \note
* @ingroup _otg
*/
int size_dist(int src, int dst, int application, int state);
/*! \fn char *random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
* \brief return a random string[size]
* \param[in] size of the string to generate,
* \param[in] size of the string to generate,
* \param[in] ALPHABET_GEN : static or random string
* \param[in] ALPHABET_TYPE : numeric or letters + numeric
* \param[out] string of a random char
* \note
* \note
* @ingroup _otg
*/
char * random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
@@ -86,12 +86,12 @@ char * random_string(int size, ALPHABET_GEN mode, ALPHABET_TYPE data_type);
/*! \fn int packet_gen(int src, int dst, int state, int ctime)
* \brief return int= 1 if the packet is generated: OTG header + header + payload, else 0
* \param[in] src source identity
* \param[in] dst destination id
* \param[in] src source identity
* \param[in] dst destination id
* \param[in] application id that might generate the packet
* \param[out] final packet size
* \param[out] final packet size
* \param[out] packet_t: the generated packet: otg_header + header + payload
* \note
* \note
* @ingroup _otg
*/
unsigned char *packet_gen(int src, int dst, int app, int ctime, unsigned int *pkt_size);
@@ -109,59 +109,60 @@ unsigned char *packet_gen(int src, int dst, int app, int ctime, unsigned int *pk
unsigned char *packet_gen_multicast(int src, int dst, int ctime, unsigned int * pkt_size);
/*! \fn char *header_gen(int hdr_size);
* \brief generate IP (v4/v6) + transport header(TCP/UDP)
* \param[in] int : size
* \brief generate IP (v4/v6) + transport header(TCP/UDP)
* \param[in] int : size
* \param[out] the payload corresponding to ip version and transport protocol
* \note
* \note
* @ingroup _otg
*/
unsigned char *header_gen(int hdr_size);
/*! \fn char *payload_pkts(int payload_size);
* \brief generate the payload
* \param[in] int : payload size
* \param[in] int : payload size
* \param[out] char * payload
* \note
* \note
* @ingroup _otg
*/
unsigned char *payload_pkts(int payload_size);
/*! \fn
/*! \fn
char * serialize_buffer(char* header, char* payload, unsigned int buffer_size, int flag, int flow_id, int ctime, int seq_num, int hdr_type, int state)
* \brief serilize the packet and add otg control information
* \param[in] char* header pointer to the header
* \param[in] char* payload pointer to the payload
* \param[in] buffer_size size of the serilized tx buffer
* \param[in] flag for regular and background traffic
* \param[in] flow_id
* \param[in] ctime time of the transmission
* \param[in] flag for regular and background traffic
* \param[in] flow_id
* \param[in] ctime time of the transmission
* \param[in] seq_num sequence number of the packet used to calculate the loss rate
* \param[in] hdr_type indicatting the ip protocol version and transport protocol
* \param[in] state indicate in which state (PU, ED, PE) the packet is generated when generating M2M traffic
flow id, simulation time, , sequence number, header type (to know the transport/ip version in the RX)
* \param[in] state indicate in which state (PU, ED, PE) the packet is generated when generating M2M traffic
flow id, simulation time, , sequence number, header type (to know the transport/ip version in the RX)
* \param[out] tx_buffer the serilized packet
* @ingroup _otg
*/
unsigned char * serialize_buffer(char* header, char* payload, unsigned int buffer_size, unsigned int traffic_type, int flag, int flow_id, int ctime, int seq_num, int hdr_type, int state, unsigned int aggregation_level);
unsigned char * serialize_buffer(char* header, char* payload, unsigned int buffer_size, unsigned int traffic_type, int flag, int flow_id, int ctime, int seq_num, int hdr_type, int state,
unsigned int aggregation_level);
/*! \fn int adjust_size(int size);
* \brief adjuste the generated packet size when size<min or size>max
* \param[in] size
* \brief adjuste the generated packet size when size<min or size>max
* \param[in] size
* \param[out] modified size in case
* \note
* \note
* @ingroup _otg
*/
int adjust_size(int size);
/*! \fn int header_size_genint src();
* \brief return the header size corresponding to ip version and transport protocol
* \brief return the header size corresponding to ip version and transport protocol
* \param[in] the sender (src)
* \param[out] size of packet header
* \note
* \param[out] size of packet header
* \note
* @ingroup _otg
*/
void header_size_gen(int src, int dst, int application);
@@ -169,21 +170,21 @@ void header_size_gen(int src, int dst, int application);
void init_predef_multicast_traffic(void);
/*! \fn void init_predef_traffic();
* \brief initialise OTG with predifined value for pre-configured traffic: cbr, openarena,etc.
* \param[in]
* \param[out]
* \note
* \brief initialise OTG with predifined value for pre-configured traffic: cbr, openarena,etc.
* \param[in]
* \param[out]
* \note
* @ingroup _otg
*/
void init_predef_traffic(unsigned char nb_ue_local, unsigned char nb_enb_local);
/*! \fn int background_gen(int src, int dst, int ctime);
* \brief manage idt and packet size for the backgrounf traffic.
* \brief manage idt and packet size for the backgrounf traffic.
* \param[in] src
* \param[in] dst
* \param[in] ctime
* \param[out]
* \note
* \param[out]
* \note
* @ingroup _otg
*/
int background_gen(int src, int dst, int ctime);
@@ -198,7 +199,7 @@ int otg_hdr_size(int src, int dst);
void init_packet_gen(int src, int dst, int ctime);
int check_data_transmit(int src,int dst, int app, int ctime);
int check_data_transmit(int src,int dst, int app, int ctime);
unsigned int get_application_state(int src, int dst, int application, int ctime);
+213 -198
View File
@@ -44,7 +44,7 @@
#ifdef WIN32 /* si vous êtes sous Windows */
#include <winsock2.h>
#include <winsock2.h>
#elif defined (linux) /* si vous êtes sous Linux */
@@ -75,20 +75,24 @@ control_hdr_t *control_hdr;
void socket_packet_send(int src, int dst, int state,int ctime){
void socket_packet_send(int src, int dst, int state,int ctime)
{
init_control_header();
init_control_header();
LOG_I(OTG,"SOCKET:: IP version %d, Transport Protocol %d \n", g_otg->ip_v[src], g_otg->trans_proto[src]);
LOG_I(OTG,"SOCKET:: IP version %d, Transport Protocol %d \n", g_otg->ip_v[src], g_otg->trans_proto[src]);
if ((g_otg->ip_v[src]==1) && (g_otg->trans_proto[src]==2))
client_socket_tcp_ip4(src, dst, state, ctime);
if ((g_otg->ip_v[src]==2) && (g_otg->trans_proto[src]==2))
client_socket_tcp_ip6(src, dst, state, ctime);
if ((g_otg->ip_v[src]==1) && (g_otg->trans_proto[src]==1))
client_socket_udp_ip4(src, dst, state, ctime);
if ((g_otg->ip_v[src]==2) && (g_otg->trans_proto[src]==1))
client_socket_udp_ip6(src, dst, state, ctime);
if ((g_otg->ip_v[src]==1) && (g_otg->trans_proto[src]==2))
client_socket_tcp_ip4(src, dst, state, ctime);
if ((g_otg->ip_v[src]==2) && (g_otg->trans_proto[src]==2))
client_socket_tcp_ip6(src, dst, state, ctime);
if ((g_otg->ip_v[src]==1) && (g_otg->trans_proto[src]==1))
client_socket_udp_ip4(src, dst, state, ctime);
if ((g_otg->ip_v[src]==2) && (g_otg->trans_proto[src]==1))
client_socket_udp_ip6(src, dst, state, ctime);
@@ -103,96 +107,94 @@ void client_socket_tcp_ip4(int src, int dst, int state, int ctime)
#define PORT 7777
LOG_I(OTG,"SOCKET:: TCP-IP4 :: src= %d , dst= %d , state= %d \n", src, dst, state);
LOG_I(OTG,"SOCKET:: TCP-IP4 :: src= %d , dst= %d , state= %d \n", src, dst, state);
#if defined (WIN32)
WSADATA WSAData;
int erreur = WSAStartup(MAKEWORD(2,2), &WSAData);
WSADATA WSAData;
int erreur = WSAStartup(MAKEWORD(2,2), &WSAData);
#else
int erreur = 0;
int erreur = 0;
#endif
SOCKET sock;
SOCKADDR_IN sin;
int sock_err;
double idt;
int size;
/* If we are in the case of Windows sockets*/
if(!erreur)
{
/* Create socket */
sock = socket(AF_INET, SOCK_STREAM, 0);
/* Configure the connection */
sin.sin_addr.s_addr = inet_addr(g_otg->dst_ip[src]);
sin.sin_family = AF_INET;
sin.sin_port = htons(PORT);
/* connection is ok */
printf("SOCKET:: TCP-IP4 :: \n");
SOCKET sock;
SOCKADDR_IN sin;
int sock_err;
double idt;
int size;
if(connect(sock, (SOCKADDR*)&sin, sizeof(sin)) != SOCKET_ERROR)
{
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Create socket %s with dst port %d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
ctime=0;
LOG_I(OTG,"SOCKET:: TCP-IP4 :: ctime=%d, duration=%d \n", ctime, g_otg->duration[src]);
/* If we are in the case of Windows sockets*/
if(!erreur) {
/* Create socket */
sock = socket(AF_INET, SOCK_STREAM, 0);
init_control_header();
/* Configure the connection */
sin.sin_addr.s_addr = inet_addr(g_otg->dst_ip[src]);
sin.sin_family = AF_INET;
sin.sin_port = htons(PORT);
/* connection is ok */
printf("SOCKET:: TCP-IP4 :: \n");
if(connect(sock, (SOCKADDR*)&sin, sizeof(sin)) != SOCKET_ERROR) {
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Create socket %s with dst port %d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
ctime=0;
LOG_I(OTG,"SOCKET:: TCP-IP4 :: ctime=%d, duration=%d \n", ctime, g_otg->duration[src]);
init_control_header();
do {
//payload=NULL;
//payload=packet_gen_socket(src, dst, state, ctime);
//payload="CCCCC";
do {
//payload=NULL;
//payload=packet_gen_socket(src, dst, state, ctime);
//payload="CCCCC";
char *payload_rest;
payload_rest=packet_gen_socket(src, dst, state, ctime);
char *payload_rest;
payload_rest=packet_gen_socket(src, dst, state, ctime);
if (payload_rest!=NULL)
{
if (payload_rest!=NULL) {
payload_t *payload;
payload= malloc(sizeof(payload_t));
// Data serialization
char *tx_buffer;
tx_buffer= (char *)malloc(PAYLOAD_MAX);
payload->control_hdr=otg_info_hdr_gen(src, dst, TCP, IPV4);
payload_t *payload;
payload= malloc(sizeof(payload_t));
// Data serialization
char *tx_buffer;
tx_buffer= (char *)malloc(PAYLOAD_MAX);
payload->payload_rest=payload_rest;
memcpy(tx_buffer, payload->control_hdr, sizeof (control_hdr_t));
memcpy(tx_buffer+ sizeof (control_hdr_t), payload->payload_rest, strlen(payload_rest));
payload->control_hdr=otg_info_hdr_gen(src, dst, TCP, IPV4);
payload->payload_rest=payload_rest;
memcpy(tx_buffer, payload->control_hdr, sizeof (control_hdr_t));
memcpy(tx_buffer+ sizeof (control_hdr_t), payload->payload_rest, strlen(payload_rest));
int total_size=sizeof(control_hdr_t) + strlen(payload_rest);
int total_size=sizeof(control_hdr_t) + strlen(payload_rest);
if((sock_err = send(sock, tx_buffer, total_size, 0)) != SOCKET_ERROR)
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Payload to send size :: %d \n",sock_err);
else
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Transmission Error\n");
}
ctime+=1;
if((sock_err = send(sock, tx_buffer, total_size, 0)) != SOCKET_ERROR)
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Payload to send size :: %d \n",sock_err);
else
LOG_I(OTG,"SOCKET:: TCP-IP4 :: Transmission Error\n");
}while (ctime<=g_otg->duration[src]) ;
}
}
/* connection is not possible..." */
else
LOG_I(OTG,"SOCKET:: TCP-IP4 :: connection is not possible to connect \n");
/* close the socket */
closesocket(sock);
}
ctime+=1;
} while (ctime<=g_otg->duration[src]) ;
}
/* connection is not possible..." */
else
LOG_I(OTG,"SOCKET:: TCP-IP4 :: connection is not possible to connect \n");
/* close the socket */
closesocket(sock);
}
}
@@ -200,8 +202,8 @@ init_control_header();
void client_socket_udp_ip4(int src, int dst, int state,int ctime)
{
char *payload_rest;
signed int udp_send;
char *payload_rest;
signed int udp_send;
@@ -212,165 +214,176 @@ signed int udp_send;
char *htoname = "127.0.0.1";
u_long toaddr;
LOG_I(OTG,"SOCKET:: UDP-IP4 :: src= %d , dst= %d , state= %d \n", src, dst, state);
LOG_I(OTG,"SOCKET:: UDP-IP4 :: src= %d , dst= %d , state= %d \n", src, dst, state);
to = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));
if((toinfo = gethostbyname(htoname)) == NULL){
if((toinfo = gethostbyname(htoname)) == NULL) {
LOG_W(OTG,"SOCKET:: UDP-IP4 :: Error %d in gethostbyname: %s\n", errno,sys_errlist[errno]);
exit(errno);
};
toaddr = *(u_long *)toinfo->h_addr_list[0];
addr_in_size = sizeof(struct sockaddr_in);
memset((char *)to,(char)0,addr_in_size);
to->sin_family = AF_INET;
to->sin_addr.s_addr = toaddr;
to->sin_port = portnum;
//
/*
//
/*
//set otg header to 0
control_hdr = calloc(1, sizeof(control_hdr_t));
if (control_hdr == NULL)
// Memory could not be allocated
printf("Couldn't allocate memory\n");
memset(control_hdr, 0, sizeof(control_hdr_t));
*/
//
//set otg header to 0
control_hdr = calloc(1, sizeof(control_hdr_t));
if (control_hdr == NULL)
// Memory could not be allocated
printf("Couldn't allocate memory\n");
memset(control_hdr, 0, sizeof(control_hdr_t));
*/
//
if((sockfd = socket (PF_INET, SOCK_DGRAM, 0)) == -1){
LOG_W(OTG,"SOCKET:: UDP-IP4 :: Error %d in socket: %s\n",errno,sys_errlist[errno]);
if((sockfd = socket (PF_INET, SOCK_DGRAM, 0)) == -1) {
LOG_W(OTG,"SOCKET:: UDP-IP4 :: Error %d in socket: %s\n",errno,sys_errlist[errno]);
exit(errno);
};
do {
payload_rest=packet_gen_socket(src, dst, state, ctime);
if (payload_rest!=NULL)
{
payload_t *payload;
payload= malloc(sizeof(payload_t));
// Data serialization
char *tx_buffer;
tx_buffer= (char *)malloc(PAYLOAD_MAX);
do {
payload_rest=packet_gen_socket(src, dst, state, ctime);
if (payload_rest!=NULL) {
payload_t *payload;
payload= malloc(sizeof(payload_t));
// Data serialization
char *tx_buffer;
tx_buffer= (char *)malloc(PAYLOAD_MAX);
payload->control_hdr=otg_info_hdr_gen(src, dst, UDP, IPV4);
payload->payload_rest=payload_rest;
memcpy(tx_buffer, payload->control_hdr, sizeof (control_hdr_t));
memcpy(tx_buffer+ sizeof (control_hdr_t), payload->payload_rest, strlen(payload_rest));
int total_size=sizeof(control_hdr_t) + strlen(payload_rest);
payload->control_hdr=otg_info_hdr_gen(src, dst, UDP, IPV4);
payload->payload_rest=payload_rest;
memcpy(tx_buffer, payload->control_hdr, sizeof (control_hdr_t));
memcpy(tx_buffer+ sizeof (control_hdr_t), payload->payload_rest, strlen(payload_rest));
int total_size=sizeof(control_hdr_t) + strlen(payload_rest);
udp_send=sendto(sockfd, tx_buffer,total_size ,0,(struct sockaddr *)to,addr_in_size);
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Payload to send :: data sent:%d \n", udp_send);
// Update TX OTG info
//otg_info->rx_num_pkt[src][dst]+=1;
//otg_info->rx_num_bytes[src][dst]+= udp_send + (HDR_IP_v4 + HDR_UDP);
//
udp_send=sendto(sockfd, tx_buffer,total_size ,0,(struct sockaddr *)to,addr_in_size);
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Payload to send :: data sent:%d \n", udp_send);
// Update TX OTG info
//otg_info->rx_num_pkt[src][dst]+=1;
//otg_info->rx_num_bytes[src][dst]+= udp_send + (HDR_IP_v4 + HDR_UDP);
//
if (NULL != payload){
payload=NULL;
free(payload);
}
if (NULL != payload) {
payload=NULL;
free(payload);
}
if (NULL != tx_buffer){
tx_buffer=NULL;
free(tx_buffer);
}
if (NULL != tx_buffer) {
tx_buffer=NULL;
free(tx_buffer);
}
}
if(udp_send == -1){
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Transmission Error\n");
exit(errno);
}
else
LOG_I(OTG,"SOCKET:: UDP-IP4 :: No data to transmit\n");
ctime+=1;
}while (ctime<=g_otg->duration[src]) ;
}
closesocket(sockfd);
if(udp_send == -1) {
LOG_I(OTG,"SOCKET:: UDP-IP4 :: Transmission Error\n");
exit(errno);
}
else
LOG_I(OTG,"SOCKET:: UDP-IP4 :: No data to transmit\n");
ctime+=1;
} while (ctime<=g_otg->duration[src]) ;
closesocket(sockfd);
}
void client_socket_tcp_ip6(int src, int dst, int state,int ctime)
{
printf("client TCP IPv6\n");
printf("client TCP IPv6\n");
}
void client_socket_udp_ip6(int src, int dst, int state,int ctime)
{
printf("client UDP IPv6\n");
printf("client UDP IPv6\n");
}
char* packet_gen_socket(int src, int dst, int state, int ctime){
char* packet_gen_socket(int src, int dst, int state, int ctime)
{
int size;
char *payload=NULL;
set_ctime(ctime);
LOG_I(OTG,"SOCKET :: num_nodes_tx:: %d , seed:: %d \n", g_otg->num_nodes, g_otg->seed);
LOG_I(OTG,"SOCKET :: NODE_INFO (Source= %d, Destination= %d,State= %d) ctime %d \n", src, dst, state, otg_info->ctime);
int size;
char *payload=NULL;
LOG_I(OTG,"SOCKET :: INFO_SIM (src=%d, dst=%d, state=%d) application=%d, idt dist =%d, pkts dist= %d\n", src, dst, state, g_otg->application_type[src][dst], g_otg->idt_dist[src][dst][state], g_otg->size_dist[src][dst][state]);
set_ctime(ctime);
LOG_I(OTG,"SOCKET :: num_nodes_tx:: %d , seed:: %d \n", g_otg->num_nodes, g_otg->seed);
LOG_I(OTG,"SOCKET :: Transmission info: idt=%d, simulation time=%d \n", otg_info->idt[src][dst], ctime);
// do not generate packet for this pair of src, dst : no app type and/or idt are defined
if ((g_otg->application_type[src][dst] == 0) && (g_otg->idt_dist[src][dst][0] == 0)){
LOG_I(OTG,"SOCKET :: Do not generate packet for this pair of src=%d, dst =%d: no app type and/or idt are defined\n", src, dst);
return 0;
}
LOG_I(OTG,"SOCKET :: NODE_INFO (Source= %d, Destination= %d,State= %d) ctime %d \n", src, dst, state, otg_info->ctime);
//pre-config for the standalone
if (ctime<otg_info->ptime[src][dst][state]) //it happends when the emulation was finished
otg_info->ptime[src][dst][state]=ctime;
if (ctime==0)
otg_info->idt[src][dst]=0; //for the standalone mode: the emulation is run several times, we need to initialise the idt to 0 when ctime=0
//end pre-config
if ((otg_info->idt[src][dst]==(ctime-otg_info->ptime[src][dst][state])) || (otg_info->idt[src][dst]==0)) {
LOG_I(OTG,"SOCKET :: Time To Transmit (Source= %d, Destination= %d,State= %d) , (IDT= %d ,simu time= %d, previous packet time= %d) \n", src, dst, state ,otg_info->idt[src][dst], ctime, otg_info->ptime[src][dst][state]);
otg_info->ptime[src][dst][state]=ctime;
otg_info->idt[src][dst]=time_dist(src, dst, state); // update the idt for the next otg_tx
}
else {
LOG_I(OTG,"SOCKET :: It is not the time to transmit (ctime= %d, previous time=%d, packet idt=%d), node( %d,%d) \n", ctime,otg_info->ptime[src][dst][state], otg_info->idt[src][dst], src, dst);
return 0; // do not generate the packet, and keep the idt
}
LOG_I(OTG,"SOCKET :: INFO_SIM (src=%d, dst=%d, state=%d) application=%d, idt dist =%d, pkts dist= %d\n", src, dst, state, g_otg->application_type[src][dst], g_otg->idt_dist[src][dst][state],
g_otg->size_dist[src][dst][state]);
LOG_I(OTG,"SOCKET :: Transmission info: idt=%d, simulation time=%d \n", otg_info->idt[src][dst], ctime);
size=size_dist(src, dst, state);
LOG_I(OTG,"SOCKET :: Generate Packet for (Source= %d, Destination= %d,State= %d) , pkt size dist= %d, simu time= %d ,packet size=%d \n",
src, dst, state, g_otg->size_dist[src][dst][state], otg_info->ctime, size);
// do not generate packet for this pair of src, dst : no app type and/or idt are defined
if ((g_otg->application_type[src][dst] == 0) && (g_otg->idt_dist[src][dst][0] == 0)) {
LOG_I(OTG,"SOCKET :: Do not generate packet for this pair of src=%d, dst =%d: no app type and/or idt are defined\n", src, dst);
return 0;
}
if (size>(5* sizeof(int)))
size=size-(5* sizeof(int));
else
size=(5* sizeof(int))+10;
//pre-config for the standalone
if (ctime<otg_info->ptime[src][dst][state]) //it happends when the emulation was finished
otg_info->ptime[src][dst][state]=ctime;
payload=payload_pkts(size);
if (ctime==0)
otg_info->idt[src][dst]=0; //for the standalone mode: the emulation is run several times, we need to initialise the idt to 0 when ctime=0
return(payload);
//end pre-config
if ((otg_info->idt[src][dst]==(ctime-otg_info->ptime[src][dst][state])) || (otg_info->idt[src][dst]==0)) {
LOG_I(OTG,"SOCKET :: Time To Transmit (Source= %d, Destination= %d,State= %d) , (IDT= %d ,simu time= %d, previous packet time= %d) \n", src, dst, state ,otg_info->idt[src][dst], ctime,
otg_info->ptime[src][dst][state]);
otg_info->ptime[src][dst][state]=ctime;
otg_info->idt[src][dst]=time_dist(src, dst, state); // update the idt for the next otg_tx
} else {
LOG_I(OTG,"SOCKET :: It is not the time to transmit (ctime= %d, previous time=%d, packet idt=%d), node( %d,%d) \n", ctime,otg_info->ptime[src][dst][state], otg_info->idt[src][dst], src, dst);
return 0; // do not generate the packet, and keep the idt
}
size=size_dist(src, dst, state);
LOG_I(OTG,"SOCKET :: Generate Packet for (Source= %d, Destination= %d,State= %d) , pkt size dist= %d, simu time= %d ,packet size=%d \n",
src, dst, state, g_otg->size_dist[src][dst][state], otg_info->ctime, size);
if (size>(5* sizeof(int)))
size=size-(5* sizeof(int));
else
size=(5* sizeof(int))+10;
payload=payload_pkts(size);
return(payload);
}
@@ -378,27 +391,29 @@ return(payload);
control_hdr_t *otg_info_hdr_gen(int src, int dst, int trans_proto, int ip_v)
{
control_hdr->src=src;
control_hdr->dst=dst;
control_hdr->trans_proto=trans_proto;
control_hdr->ip_v=ip_v;
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->src);
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->dst);
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->trans_proto);
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->ip_v);
control_hdr->src=src;
control_hdr->dst=dst;
control_hdr->trans_proto=trans_proto;
control_hdr->ip_v=ip_v;
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->src);
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->dst);
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->trans_proto);
LOG_I(OTG,"SOCKET :: control header src %d\n",control_hdr->ip_v);
return control_hdr;
return control_hdr;
}
void init_control_header()
{
//set otg header to 0
control_hdr = calloc(1, sizeof(control_hdr_t));
if (control_hdr == NULL)
/* Memory could not be allocated */
printf("Couldn't allocate memory\n");
memset(control_hdr, 0, sizeof(control_hdr_t));
//set otg header to 0
control_hdr = calloc(1, sizeof(control_hdr_t));
if (control_hdr == NULL)
/* Memory could not be allocated */
printf("Couldn't allocate memory\n");
memset(control_hdr, 0, sizeof(control_hdr_t));
}
+12 -12
View File
@@ -55,8 +55,8 @@
* \brief this function allow to run the client, with the appropriate parameters.
* \param[in] src, dst and the state
* \param[out] void
* \return void
* \note
* \return void
* \note
* @ingroup _otg
*/
void socket_packet_send(int src, int dst, int state,int ctime);
@@ -65,8 +65,8 @@ void socket_packet_send(int src, int dst, int state,int ctime);
* \brief this function allow to run the client, with IPv4 and TCP protocol.
* \param[in] src, dst and the state
* \param[out] void
* \return void
* \note
* \return void
* \note
* @ingroup _otg
*/
void client_socket_tcp_ip4(int src, int dst, int state,int ctime);
@@ -75,8 +75,8 @@ void client_socket_tcp_ip4(int src, int dst, int state,int ctime);
* \brief this function allow to run the client, with IPv6 and TCP protocol.
* \param[in] src, dst and the state
* \param[out] void
* \return void
* \note
* \return void
* \note
* @ingroup _otg
*/
void client_socket_tcp_ip6(int src, int dst, int state,int ctime);
@@ -85,8 +85,8 @@ void client_socket_tcp_ip6(int src, int dst, int state,int ctime);
* \brief this function allow to run the client, with IPv4 and UDP protocol.
* \param[in] src, dst and the state
* \param[out] void
* \return void
* \note
* \return void
* \note
* @ingroup _otg
*/
void client_socket_udp_ip4(int src, int dst, int state,int ctime);
@@ -95,8 +95,8 @@ void client_socket_udp_ip4(int src, int dst, int state,int ctime);
* \brief this function allow to run the client, with IPv6 and UDP protocol.
* \param[in] src, dst and the state
* \param[out] void
* \return void
* \note
* \return void
* \note
* @ingroup _otg
*/
void client_socket_udp_ip6(int src, int dst, int state,int ctime);
@@ -105,9 +105,9 @@ void client_socket_udp_ip6(int src, int dst, int state,int ctime);
/*! \fn int packet_gen(int src, int dst, int state, int ctime)
* \brief return char * pointer over the payload, else NULL
* \param[in] source,
* \param[in] source,
* \param[out] packet_t: the generated packet: otg_header + header + payload
* \note
* \note
* @ingroup _otg
*/
char* packet_gen_socket(int src, int dst, int state, int ctime);
+42 -49
View File
@@ -28,7 +28,7 @@
*******************************************************************************/
/*! \file otg_vars.h
* \brief Global structure
* \brief Global structure
* \author navid nikaein and A. Hafsaoui
* \date 2011
* \version 1.0
@@ -48,8 +48,7 @@ otg_info_t *otg_info; /*!< \brief info otg: measurements about the simulation
otg_multicast_info_t *otg_multicast_info; /*!< \brief info otg: measurements about the simulation */
otg_forms_info_t *otg_forms_info;
mapping otg_app_type_names[] =
{
mapping otg_app_type_names[] = {
{"no_predefined_traffic", 0},
{"m2m", 1},
{"scbr", 2},
@@ -88,19 +87,17 @@ mapping otg_app_type_names[] =
{"background_users", 35},
{NULL, -1}
};
mapping otg_transport_protocol_names[] =
{
{"no_proto", 0},
{"udp", 1},
{"tcp", 2},
{NULL, -1}
mapping otg_transport_protocol_names[] = {
{"no_proto", 0},
{"udp", 1},
{"tcp", 2},
{NULL, -1}
};
mapping otg_ip_version_names[] =
{
{"no_ip", 0},
{"ipv4", 1},
{"ipv6", 2},
{NULL, -1}
mapping otg_ip_version_names[] = {
{"no_ip", 0},
{"ipv4", 1},
{"ipv6", 2},
{NULL, -1}
};
mapping otg_multicast_app_type_names[] = {
@@ -115,45 +112,41 @@ mapping otg_multicast_app_type_names[] = {
{NULL, -1}
} ;
mapping otg_distribution_names[] =
{
{"no_customized_traffic", 0},
{"uniform", 1},
{"gaussian", 2},
{"exponential", 3},
{"poisson", 4},
{"fixed", 5},
{"weibull", 6},
{"pareto", 7},
{"gamma", 8},
{"cauchy",9},
{"log_normal",10},
{"tarma",11},
{"video",12},
{"background_dist",13},
{NULL, -1}
mapping otg_distribution_names[] = {
{"no_customized_traffic", 0},
{"uniform", 1},
{"gaussian", 2},
{"exponential", 3},
{"poisson", 4},
{"fixed", 5},
{"weibull", 6},
{"pareto", 7},
{"gamma", 8},
{"cauchy",9},
{"log_normal",10},
{"tarma",11},
{"video",12},
{"background_dist",13},
{NULL, -1}
};
mapping frame_type_names[] =
{
{"TDD", 1},
{"FDD", 0},
{NULL, -1}
mapping frame_type_names[] = {
{"TDD", 1},
{"FDD", 0},
{NULL, -1}
};
mapping switch_names[] =
{
{"disable", 0},
{"enable", 1},
{NULL, -1}
mapping switch_names[] = {
{"disable", 0},
{"enable", 1},
{NULL, -1}
};
mapping packet_gen_names[] =
{
{"repeat_string", 0},
{"substract_string", 1},
{"random_position", 2},
{"random_string", 3},
{NULL, -1}
mapping packet_gen_names[] = {
{"repeat_string", 0},
{"substract_string", 1},
{"random_position", 2},
{"random_string", 3},
{NULL, -1}
};
//int ptime; /*!< \brief ptime is uses to compute the local simulation time */
+3 -3
View File
@@ -27,10 +27,10 @@
*******************************************************************************/
//IDT DISTRIBUTION PARAMETERS
#define IDT_DIST GAUSSIAN
#define IDT_MIN 2
#define IDT_MIN 2
#define IDT_MAX 10
#define IDT_STD_DEV 1
#define IDT_LAMBDA 3
@@ -40,7 +40,7 @@
#define IP_V IPV4
//DATA PACKET SIZE DISTRIBUTION PARAMETERS
#define PKTS_SIZE_DIST POISSON
#define PKTS_SIZE_DIST POISSON
#define PKTS_SIZE_MIN 17
#define PKTS_SIZE_MAX 1500
#define PKTS_SIZE_STD_DEV 30