• Non ci sono risultati.

e) UDP-128-54M d)UDP-1472-11M c)UDP-512-11M b) UDP-128-11Mb a) UDP-1024-11Mbit Appendice

N/A
N/A
Protected

Academic year: 2021

Condividi "e) UDP-128-54M d)UDP-1472-11M c)UDP-512-11M b) UDP-128-11Mb a) UDP-1024-11Mbit Appendice"

Copied!
12
0
0

Testo completo

(1)
(2)

Appendice

a) UDP-1024-11Mbit

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [1342.0 1024]

60.0 OFF 1

b) UDP-128-11Mb

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [10742 128]

60.0 OFF 1

c)UDP-512-11M

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [2685 512

60.0 OFF 1

d)UDP-1472-11M

ON 1 UDP DST 192.168.100.71/11000 PERIODIC [934 1472]

60.0 OFF 1

e) UDP-128-54M

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [52734 128]

60.0 OFF 1

(3)

f) UDP-512-54M

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [13183 512]

60.0 OFF 1

g) UDP-1024-54M

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [6591 1024]

60.0 OFF 1

h) UDP-1472-54M

0.0 ON 1 UDP DST 192.168.100.71/11000 PERIODIC [4585 1472]

60.0 OFF 1

i) QLINK

#include <stdio.h> #include <stdlib.h> #include <time.h> #include <dirent.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <ctype.h> #include <math.h> #include <limits.h> #include <errno.h> #include <signal.h> #include <sys/wait.h> #include <sys/stat.h> #include <sys/param.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/timex.h>

(4)

int main(void)

{ /* Inizio della funzione main() */

int errore = 0; /* Variabile che uso per segnare eventuali errori */ FILE *leggoinput; /* Definisco 2 strutture FILE */

char *line = (char *)malloc(256); char iface[5]; char status [3]; float link = 0; float level = 0; float noise = 0; int nwid = 0; int crypt = 0; int misc = 0;

int update_rate = 10000; /*tempo di attesa per nuovi dati in usec*/ struct ntptimeval tempo_ora;

struct timeval hms_struct;

/* Provo ad aprire il file /proc/net/wireless in modalita' lettura file di testo */ if ((leggoinput = fopen("/proc/net/wireless", "rt")) == NULL) {

printf("\nNon posso aprire il file /proc/net/wireless.\n"); /*Il file /proc/net/wireless non esiste*/ errore=1;

}

if (errore==0) {

printf("\n\t Time \t\t\t\t Link Quality \t\t Signal Level \t\t\t Noise Level\n\n"); while(1) {

leggoinput = fopen("/proc/net/wireless", "rt");

fgets(line, 255, leggoinput); /* Le prime due righe non contengono registrazioni*/ fgets(line, 255, leggoinput);

(5)

if (fgets(line, 255, leggoinput) == NULL) errore=2; else { sscanf(line,"%s %s %f %f %f %d %d %d", iface,status,&link,&level,&noise,&nwid,&crypt,&misc); } ntp_gettime(&tempo_ora); hms_struct = tempo_ora.time; printf("\t %10.6f \t\t %3.2f \t\t\t %3.2f \t\t\t %3.2f\n", (double)( hms_struct.tv_sec+(double)(hms_struct.tv_usec)/1000000), link,level,noise); fclose (leggoinput); usleep(update_rate); } } if(errore!=1) fclose(leggoinput);

if(errore==1) printf("Non trovo il file /proc/net/wireless.\n"); if(errore==2) printf("Nessun dato disponibile.\n");

}

l) Wireless_mon

#ifndef __KERNEL__ # define __KERNEL__ #endif #ifndef MODULE # define MODULE #endif

(6)

#define WIRELESS_POLL_PERIOD (HZ/10) #define WIRELESS_NIC_POLL_PERIOD (10*HZ) #include <linux/config.h>

#include <linux/module.h>

#include <linux/kernel.h> /* printk() */ //#include "sysdep.h" #include <linux/timer.h> #include <linux/wireless.h> #include <linux/netdevice.h> #include <linux/if_arp.h> #include <linux/magnet.h> #ifdef LINUX_20

# error "This module can't run with Linux-2.0" #endif

MODULE_AUTHOR("Giuseppe Risi"); /*

* Forwards for our methods. */

static struct timer_list wireless_timer; static struct timer_list wireless_nic_timer; struct wireless_station {

(7)

struct list_head list;

struct iw_quality link_quality; /* Wireless link quality */ __u8 state;

__u8 is_current; struct net_device *dev;

int ifindex;

int preference; /* Preference of wireless network interface */ __u8 link_quality_handoff;

};

struct net_device *dev_local; #define MAX_WIRELESS 2 static void

wireless_poll (unsigned long dummy) {

struct iw_statistics *stats;

//struct wireless_station *curr = NULL;

struct wireless_information w_information; stats = (dev_local->get_wireless_stats ?

dev_local->get_wireless_stats(dev_local) : (struct iw_statistics *) NULL);

if (stats != (struct iw_statistics *) NULL) { w_information.ifindex = dev_local->ifindex; w_information.quality = stats->qual.qual; w_information.level = stats->qual.level; w_information.noise = stats->qual.noise; MAGNET_ADD(MAGNET_WIRELESS_INFO, 0, 0, MAGNET_WIRELESS_DATA_INFO(&w_information));

printk("[wireless_monitor] interface index: %u quality: %u signal: %u noise: %u\n", dev_local->ifindex, stats->qual.qual,stats->qual.level -

(8)

0x95,stats->qual.noise - 0x95); }

//printk("[wireless_monitor] interface index: quality: %u \n", *quality); wireless_timer.expires = jiffies + WIRELESS_POLL_PERIOD;

add_timer(&wireless_timer); }

static void

wireless_nic_poll (unsigned long dummy) {

struct iw_statistics *stats;

//struct wireless_station *curr = NULL; struct net_device *dev;

read_lock(&dev_base_lock);

for (dev = dev_base; dev; dev = dev->next) { if (dev->flags & IFF_UP &&

dev->type != ARPHRD_LOOPBACK) { stats = (dev->get_wireless_stats ? dev->get_wireless_stats(dev) : (struct iw_statistics *) NULL);

if (stats != (struct iw_statistics *) NULL) {

//printk("[wireless_monitor] interface index: %u quality: %u signal: % u noise: %u\n", dev->ifindex, stats->qual.qual,stats->qual.level - 0x95,stats->qual.noise - 0x95); i

dev_local=dev; }

} }

(9)

wireless_nic_timer.expires = jiffies + WIRELESS_NIC_POLL_PERIOD; add_timer(&wireless_nic_timer); } /* * Module housekeeping. */

static int wireless_monitor_init(void) {

struct iw_statistics *stats; struct net_device *dev; init_timer(&wireless_timer); init_timer(&wireless_nic_timer); read_lock(&dev_base_lock);

for (dev = dev_base; dev; dev = dev->next) { if (dev->flags & IFF_UP &&

dev->type != ARPHRD_LOOPBACK) { stats = (dev->get_wireless_stats ? dev->get_wireless_stats(dev) : (struct iw_statistics *) NULL);

if (stats != (struct iw_statistics *) NULL) {

//printk("[wireless_monitor] interface index: %u quality: %u signal: %u noise: %u\n", dev->ifindex, stats->qual.qual,stats->qual.level - 0x95,stats->qual.noise - 0x95); i dev_local=dev;

} } }

read_unlock(&dev_base_lock);

wireless_timer.expires = jiffies + WIRELESS_POLL_PERIOD;

wireless_nic_timer.expires = jiffies + WIRELESS_NIC_POLL_PERIOD; wireless_timer.function = wireless_poll;

(10)

add_timer(&wireless_timer); add_timer(&wireless_nic_timer); return 0;

}

static void wireless_monitor_cleanup(void) { del_timer(&wireless_timer); del_timer(&wireless_nic_timer); } module_init(wireless_monitor_init); module_exit(wireless_monitor_cleanup); MODULE_LICENSE("GPL");

m) Ascolto

0.0 LISTEN UDP 11000

60.0 IGNORE UDP 11000

o) Aggrega.awk

#! /usr/bin/awk -f

# Indicare i valori di T e del PacketSize in Byte

# Es.: awk -f aggrega.awk t=0.1 size=612

BEGIN {

indice = 1

temp = 0

}

(11)

{

if ( $1 < (t*indice) ) {

temp += 8 * size

}

else {

print( (t*indice),temp/t)

temp = 0

indice++

}

}

p)Seq-Ack-Azzera

#!/usr/bin/awk -f

BEGIN { trovato=1

}

{

if($2=="SEQ")

{if(trovato)

{inizio=$3-1}

trovato=0;

printf ("%10.12f\tSEQ\t%s\tN/A\t\tN/A\t%s\t\t%s\t\t%1.2f\t\t%

1.2f\t\tN/A\t\tN/A\t\tN/A\t\tN/A\n",$1,$3-inizio,$6,$7,$8,$9)

}

if($2=="WIR")

{print $0}

if($2=="ACK")

{

printf ("%10.12f\tACK\tN/A\t%s\t\tN/A\t%s\t\t%s\t\t%1.2f\t\t%

1.2f\t\tN/A\t\tN/A\t\tN/A\t\tN/A\n",$1,$4-inizio,$6,$7,$8,$9)

}

}

r) awk.elab_tcp

(12)

#!/usr/bin/awk -f BEGIN { primo = 1 } { if (primo) { start_time =$1 primo = 0.0 }

if ($6=="SEQ" && $14 == port) {

printf ("%10.12f\tSEQ\t%s\tN/A\t\tN/A\t%s\t\t%s\t\t%1.2f\t\t%

1.2f\t\tN/A\t\tN/A\t\tN/A\t\tN/A\n",$1-start_time,$8-inizio,$20,$22,$18/100, $16/100) }

if (($6=="ACK" || $6=="ACK1") && $14 == port) {

printf ("%10.12f\tACK\tN/A\t\t%s\tN/A\t%s\t\t%s\t\t%1.2f\t\t% 1.2f\t\tN/A\t\tN/A\t\tN/A\t\tN/A\n",$1-start_time,$8-inizio,$20,$22,$18/100, $16/100) } if ($4=="Wireless") { printf ("%10.12f\tWIR\tN/A\t\tN/A\t\t%s\t\tN/A\t\tN/A\t\tN/A\t\tN/A\tN/A\t\t\t%s\t\t% s\n",$1-start_time,$8,$10,$12) } }

Riferimenti

Documenti correlati