Transcript
ANWTATO TEQNOLOGIKO EKPAIDEUTIKO IDRUMA KRHTHS
Ptuqiak ErgasÐa
Montèlo prosomoÐwshc thc ULE enjulkwshc Spoudast c:
Eishght c:
Nikìlaoc Borniwtkhc
Dr. Euggeloc Pllhc
31 OktwbrÐou 2007
2
EuqaristÐec
Me thn olokl rwsh thc ptuqiak c mou ergasÐac, h opoÐa ulopoi jhke sto Ergast rio Thlepikoinwni¸n kai ∆iktÔwn (PASIFAH) tou A.T.E.I Kr thc, ja jela na euqarist sw touc anjr¸pouc oi opoÐoi bo jhsan sthn pertwsh aut c thc ergasÐac. Ja tan parleiyh na mhn anaferj¸ se ìlouc ekeÐnouc pou sumparastjhkan se aut n thn prospjeia. Kat kÔrio lìgo, ofeÐlw na euqarist sw ton epiblèpont mou kajhght apì to A.T.E.I Kr thc k. Pllh Euggelo gia thn, kaj'ìlh thn dirkeia thc ptuqiak c ergasÐac, upost rixh kai paroq thc ulikoteqnik c upodom c, aparaÐththc gia mia melèth tètoiou eÐdouc. IdiaÐterec euqaristÐec ofeÐlontai stouc ergasthriakoÔc sunergtec tou ergasthrÐou Thlepikoinwni¸n kai DiktÔwn (PASIFAH) tou A.T.E.I. Kr thc k. Markkh Euggelo, k. Sidèrh Anrguro kaj¸c kai stouc upoy fiouc didktorec k. Mastorkh Ge¸rgio kai k. XuloÔrh Ge¸rgio. H sumbol ìlwn tan kajoristik c shmasÐac gia thn epituq èkbash thc ergasÐac aut c, kaj¸c oi polÔtimec sumboulèc touc kai h st rixh pou mou prosèferan ìpote qreisthke, katferan na periorÐsoun shmantik tic ìpoiec dusqèreiec miac tètoiac èreunac. Tèloc, euqarist¸ ìlouc ekeÐnouc pou tan dÐpla mou se ìlh aut thn prospjeia parèqontac aperiìristh yuqologik upost rixh kai katanìhsh. Hrkleio, Septèmbrioc 2007 Borniwtkhc Nikìlaoc
Perieqìmena
Perieqìmena
3
Katlogoc Sqhmtwn
7
Katlogoc Pinkwn
9
1
2
3
Eisagwg
11
1.1
Genik perigraf . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2
Stìqoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3
Dom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
To prìtupo
MPEG
13
2.1
Moving Picture Experts Group
. . . . . . . . . . . . . . . . .
13
2.2
MPEG-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
2.2.1
Pr¸th fsh polÔplexhc . . . . . . . . . . . . . . . . . 18
2.2.2
DeÔterh fsh polÔplexhc . . . . . . . . . . . . . . . . 19 2.2.2.1
Program Stream
. . . . . . . . . . . . . . . .
19
2.2.2.2
Transport Stream . . . . . . . . . . . . . . . .
19
To prìtupo
DVB
25
3.1
LeitourgÐa kai efarmog tou protÔpou
3.2
Stdia diamìrfwshc
DVB-T
. . . . . . . . . . . . . . . . . . . 29
3.2.1
Prosarmog
MPEG-2
pakètwn kai tuqaiopoÐ- hsh . . . 29
3.2.2
Exwterik kwdikopoÐhsh kai suneliktik diemplok . . . 30
3.2.3
Eswterik kwdikopoÐhsh kai diemplok . . . . . . . . . 31
3.2.4
∆iamìrfwsh kai metdosh . . . . . . . . . . . . . . . . 31 3
DVB-T
. . . . . . . . . 27
4
Perieqìmena 3.2.5
4
5
6
Wfèlimo
bit rate
3.3
Metdosh
3.4
Amfidromikìthta
IP
. . . . . . . . . . . . . . . . . . . . . . 33
dedomènwn pnw apì to kanli
DVB-T
. . . . . . 34
. . . . . . . . . . . . . . . . . . . . . . . . . 35
H mèjodoc enjulkwshc
ULE
37
4.1
Qarakthristik . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.2
SÔgkrish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.3
Upost rixh . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Sqediasmìc
43
5.1
Apait seic ulikoÔ . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.2
Sqediasmìc diktÔou . . . . . . . . . . . . . . . . . . . . . . . . 44
5.3
Sqediasmìc efarmog c . . . . . . . . . . . . . . . . . . . . . . 45
UlopoÐhsh
47
6.1
UlopoÐhsh kìmbou . . . . . . . . . . . . . . . . . . . . . . . . 47
6.2
UlopoÐhsh diktÔou . . . . . . . . . . . . . . . . . . . . . . . . 48 6.2.1
6.3
AlusÐda ekpomp c . . . . . . . . . . . . . . . . . . . . . 51
UlopoÐhsh efarmog c . . . . . . . . . . . . . . . . . . . . . . . 52 6.3.1
Buers . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.2
EpikoinwnÐa me thn krta . . . . . . . . . . . . . . . . . 52
6.3.3
6.3.4
6.3.5
52
6.3.2.1
ArqikopoÐhsh . . . . . . . . . . . . . . . . . . 52
6.3.2.2
Apostol dedomènwn . . . . . . . . . . . . . . 52
Sullog
IP
6.3.3.1
Biblioj kh
6.3.3.2
IP buer
. . . . . . . . . . . . . . . . . . . .
6.3.3.3
To
sullog c pakètwn . . . . . . . . . 54
pakètwn . . . . . . . . . . . . . . . . . . . 53
thread
libpcap
. . . . . . . . . . . . . . . 53 53
Enjulkwsh . . . . . . . . . . . . . . . . . . . . . . . . 54 6.3.4.1
Algìrijmoc enjulkwshc . . . . . . . . . . . 54
6.3.4.2
UlopoÐhsh enjulakwt . . . . . . . . . . . . . 56
6.3.4.3
Crc checksum . . . . . . . . . . . . . . . . . .
57
6.3.4.4
TS buer
59
6.3.4.5
Apostol . . . . . . . . . . . . . . . . . . . . 59
. . . . . . . . . . . . . . . . . . . .
DhmiourgÐa pakètwn elègqou . . . . . . . . . . . . . . . 59
PERIEQOMENA
7
PAT . . . . . . . . . . . . . . . . . . . . . . .
59
6.3.5.2
PMT
60
6.3.5.3
SDT
6.3.5.4
Apostol . . . . . . . . . . . . . . . . . . . . 61
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . 61
63
ErgaleÐa metr sewn . . . . . . . . . . . . . . . . . . . . . . . . 63 7.1.1
tcpdump . . . . . . . . . . . . . . . . . . . . . . . . . .
63
7.1.2
mgen . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
7.1.3
dvbnet . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
7.1.4
scripts . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
7.1.5
gnuplot
65
. . . . . . . . . . . . . . . . . . . . . . . . . .
7.2
Senria metr sewn . . . . . . . . . . . . . . . . . . . . . . . . 65
7.3
PragmatopoÐhsh metr sewn . . . . . . . . . . . . . . . . . . . . 65 7.3.1
ParametropoÐhsh enjulakwt . . . . . . . . . . . . . . 65
7.3.2
PragmatopoÐhsh metr sewn axiolìghshc diktÔou . . . . 68
LeitourgÐa
8.1
9
6.3.5.1
'Elegqoc
7.1
8
5
71
Egkatstash . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 8.1.1
Egkatstash odhg¸n krtac . . . . . . . . . . . . . . . 71
8.1.2
Suntonismìc . . . . . . . . . . . . . . . . . . . . . . . . 72
8.1.3
dvbnet . . . . . . . . . . . . . . . . . . . . . . . . . . .
72
8.2
LeitourgÐa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
8.3
ParametropoÐhsh . . . . . . . . . . . . . . . . . . . . . . . . . 73
ParousÐash metr sewn
9.1
9.2
75
ParousÐash apotelesmtwn . . . . . . . . . . . . . . . . . . . . 75 9.1.1
Apìdosh . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.1.2
Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . 77
9.1.3
Metabol thc kajustèrhshc . . . . . . . . . . . . . . . 78
9.1.4
Ap¸leiec . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Sqoliasmìc apotelesmtwn . . . . . . . . . . . . . . . . . . . . 80
10 Sumpersmata
81
Perieqìmena
6
BibliografÐa
83
Index
85
Aþ Diagrmmata
87
Bþ K¸dikec
B.1
B.2
107
ULE
Enjulakwt c
B.1.1
ulencap.c
B.1.2
buer.c . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
B.1.3
captureThread.c . . . . . . . . . . . . . . . . . . . . . . 110
B.1.4
stu_tx.c
. . . . . . . . . . . . . . . . . . . . . . . . . 121
Scripts
anlushc
. . . . . . . . . . . . . . . . . . . . . . . . . 129
B.2.1
bash
B.2.3
perl
. . . . . . . . . . . . . . . . . . . . . . . . . 107
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Bþ.2.1.1 B.2.2
. . . . . . . . . . . . . . . . . . . . . . . . 107
udp_ipv4
. . . . . . . . . . . . . . . . . . . . 129
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
B.2.2.1
ipv4_createendles.pl
. . . . . . . . . . . . . 131
B.2.2.2
ipv_all_losses.pl . . . . . . . . . . . . . . . . 134
B.2.2.3
ipv_all_sender_receiver_rate.pl
. . . . . . . 138
B.2.2.4
ipv_all_align_for_delay_jitt.pl
. . . . . . . 140
B.2.2.5
ipv_all_timestamp.pl
B.2.2.6
ipv_all_inter_arrival_jitter.pl
B.2.2.7
ipv_all_one_way_delay.pl
B.2.2.8
ipv_all_jitter.pl
gnuplot
. . . . . . . . . . . . . . . . . . . . . . . . . . 151
B.2.3.1
losses.gpl
B.2.3.2
one_way.gpl
B.2.3.3
jitter.gpl . . . . . . . . . . . . . . . . . . . . . 152
B.2.3.4
jitter_smooth.gpl . . . . . . . . . . . . . . . . 152
. . . . . . . . . . . . . 141 . . . . . . . . 143
. . . . . . . . . . 147
. . . . . . . . . . . . . . . . 149
. . . . . . . . . . . . . . . . . . . . 151 . . . . . . . . . . . . . . . . . . 151
Katlogoc Sqhmtwn
2.1
Roèc bÐnteo, qou kai dedomènwn sunduzontai gia na sqhmatÐsoun surmoÔc
PS
2.2
H dom enìc
PES
2.3
H dom enìc
TS
3.1
DVB
kai
TS.
. . . . . . . . . . . . . . . . . . . . . 17
pakètou. . . . . . . . . . . . . . . . . . . . . 18
pakètou. . . . . . . . . . . . . . . . . . . . . . 22
diamorfomèno s ma. . . . . . . . . . . . . . . . . . . . . 32
4.1
Mia tupik morf enìc
4.2
To digramma leitourgÐac enìc
4.3
To
6.1
H eÐsodoc diktÔou kai h
6.2
H krta
6.3
H arqitektonik tou diktÔou pou qrhsimopoi jhke gia tic metr -
ULE
kai to
MPE
SNDU.
. . . . . . . . . . . . . . . . . . 38 ULE
enjulakwt . . . . . . . . . 39
sta epÐpeda tou ASI
DVB.
èxodoc tou
DVB Master III Tx.
. . . . . . . . . . . 40
ULE
enjulakwt .
. . 48
. . . . . . . . . . . . . . . . . . . 49
seic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.4
O
6.5
Digramma ro c gia thn mèjodo tou
7.1
Ta apotelèsmata twn metr sewn gia thn eÔresh tou bèltistou
DVB-T
buer.
7.2
diamorfwt c. . . . . . . . . . . . . . . . . . . . . . . 51 packing.
. . . . . . . . . . 58
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Oi grafikèc parastseic thc kajustèrhshc, twn apwlei¸n, thc metabol c thc kajustèrhshc kai thc exomalumènhc metabol c thc kajustèrhshc sunart sei tou qrìnou. . . . . . . . . . . . . 68
9.1
Apìdosh tou diktÔou. . . . . . . . . . . . . . . . . . . . . . . . 76
9.2
To digramma kajustèrhshc. . . . . . . . . . . . . . . . . . . . 77 7
Katlogoc Sqhmtwn
8
9.3
H metabol thc kajustèrhshc. . . . . . . . . . . . . . . . . . . 78
9.4
Oi ap¸leiec tou sust matoc. . . . . . . . . . . . . . . . . . . . 79
Aþ.1 Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Aþ.2 Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Aþ.3 Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Aþ.4 Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Aþ.5 Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Aþ.6 Kajustèrhsh . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Aþ.7 Metabol kajustèrhshc . . . . . . . . . . . . . . . . . . . . . 94 Aþ.8 Metabol kajustèrhshc . . . . . . . . . . . . . . . . . . . . . 95 Aþ.9 Metabol kajustèrhshc . . . . . . . . . . . . . . . . . . . . . 96 Aþ.10Metabol kajustèrhshc . . . . . . . . . . . . . . . . . . . . . 97 Aþ.11Metabol kajustèrhshc . . . . . . . . . . . . . . . . . . . . . 98 Aþ.12Metabol kajustèrhshc . . . . . . . . . . . . . . . . . . . . . 99 Aþ.13Exomalumènh metabol thc kajustèrhshc . . . . . . . . . . . . 100 Aþ.14Exomalumènh metabol thc kajustèrhshc . . . . . . . . . . . . 101 Aþ.15Exomalumènh metabol thc kajustèrhshc . . . . . . . . . . . . 102 Aþ.16Exomalumènh metabol thc kajustèrhshc . . . . . . . . . . . . 103 Aþ.17Exomalumènh metabol thc kajustèrhshc . . . . . . . . . . . . 104 Aþ.18Exomalumènh metabol thc kajustèrhshc . . . . . . . . . . . . 105
Katlogoc Pinkwn
4.1
To
overhead
pou apaiteÐtai gia orismèna eÐdh metadìsewn. . . . 41
9
10
Katlogoc Pinkwn
Keflaio 1
Eisagwg
1.1
Genik perigraf
To jèma me to opoÐo asqoleÐtai h sugkekrimènh ptuqiak ergasÐa, afor th melèth, th sqedÐash, thn ulopoÐhsh kai thn axiolìghsh enìc montèlou
ULE
enjulkwshc me thn qr sh platfìrmac epÐgeiac yhfiak c thleìrashc. Sta plaÐsia aut o sqediasmìc kai h melèth enìc tètoiou montèlou sthrÐzetai sthn teqnologÐa tou
Digital Video Broadcasting - Terrestrial (DVB-T)
kai stic
sÔgqronec teqnikèc enjulkwshc pou èqoun protajeÐ (ULE). Gia ton skopì autì ja ulopoihjeÐ mÐa diktuak efarmog h opoÐa ja analbei thn epèktash enìc klassikoÔ ethernet diktÔou sta ìria thc perioq c kluyhc thc yhfiak c thleìrashc knontac qr sh twn teqnik¸n thc
1.2
ULE
enjulkwshc.
Stìqoi
Basikìc stìqoc thc ptuqiak c ergasÐac aut c eÐnai h anptuxh thc efarmog c h opoÐa, ìpwc dh anafèrjhke, ja diasundèei èna klasikì dÐktuo me èna dÐktuo ekpomp c ìpwc autì thc yhfiak c thleìrashc. Sta plaÐsia autoÔ tou stìqou ja dhmiourghjeÐ kai èna prìtupo dÐktuo, pou ja prosfèrei aut n thn leitourgikìthta, ¸ste na eÐnai dunat h axiolìghsh thc proteinìmenhc arqitektonik c. 11
Keflaio 1. Eisagwg
12
1.3
Dom
Se mia prospjeia gia thn sfairik kluyh twn arq¸n pou dièpoun èna tètoio sÔsthma èqoun eisaqjeÐ ta keflaia 2, 3 kai 4. Sto keflaio 2 gÐnetai h parousÐash tou protÔpou MPEG to opoÐo apoteleÐ shmantikì kommti thc èreunac afoÔ ìla ta dedomèna pou diakinoÔntai se èna kanli yhfiak c thleìrashc eÐnai sthn morf MPEG2-TS surm¸n dedomènwn. Sto keflaio 3 gÐnetai h parousÐash tou protÔpou
DVB-T.
Sto keflaio 4 parousizetai kai analÔetai h mèjodoc enjulkwshc ULE. Se aut n sthrÐzetai h melèth aut . Sto keflaio 5 gÐnetai o sqediasmìc tou sust matoc kai analÔontai oi apait seic apì pleurc ulikoÔ gia ta epimèrouc stoiqeÐa tou. To prìblhma bolidoskopeÐtai apì thn pleur thc efarmog c, thn pleur tou ulikoÔ kai thn pleur tou diktÔou. Sto keflaio 6 analÔetai h diadikasÐa gia thn ulopoÐhsh twn epimèrouc stoiqeÐwn tou sust matoc. Sto keflaio 7 perigrfetai h logik kai h diadikasÐa twn metr sewn gia thn axiolìghsh tou diktÔou pou ulopoi jhke. Sto keflaio 8 perigrfetai h diadikasÐa pou akolouj jhke gia na sthjeÐ to sÔsthma se èna
Linux
mhqnhma.
Sto keflaio 9 parousizontai kai sqolizontai ta apotelèsmata twn metr sewn. Sto keflaio 10 analÔontai ta sumpersmata kai gÐnontai protseic gia mellontikèc belti¸seic.
Keflaio 2
To prìtupo
MPEG
Se autì to keflaio ja parousiasteÐ to prwtokìllo MPEG. To prwtìkollo autì apoteleÐtai apì poll xeqwrist kommtia kai kajorÐzei metaxÔ llwn prìtupa sumpÐeshc eikìnac kai qou, prìtupa polÔplexhc reumtwn dedomènwn pragmatikoÔ qrìnou, prìtupa epikoinwnÐac exuphretht kai pelat¸n k.a. IdiaÐterh èmfash ja dojeÐ sto prìtupo
MPEG-TS,
to opoÐo qrhsimopoieÐtai gia
thn polÔplexh kai thn paketopoÐhsh twn dedomènwn pou prìkeitai na metaferjoÔn. Prìkeitai gia èna prìtupo eidik sqediasmèno gia diktuak qr sh, to opoÐo eÐnai arket anjektikì se sflmata metdoshc kai qrhsimopoieÐtai eurèwc stic metadìseic doruforik c yhfiak c thleìrashc.
2.1
Moving Picture Experts Group
To akrwnÔmio
MPEG (Moving Picture Experts Group)
eÐnai ta arqik miac
omdac ergasÐac tou International Organization for Standardization (ISO) kai tou
International Electrotechnical Commission (IEC),
h opoÐa eÐnai epifor-
tismènh me thn anptuxh protÔpwn kwdikopoÐhshc gia yhfiakì bÐnteo kai qo. H omda xekÐnhse tic ergasÐec thc to 1988 kai s mera arijmeÐ 350 mèlh tìso apì to q¸ro thc biomhqanÐac ìso kai apì ton akadhmaðkì q¸ro. Prìkeitai gia mÐa eurèwc apodekt omda ergasÐac kai ta prwtìkolla pou èqei mèqri stigm c ekd¸sei qrhsimopoioÔntai eurèwc apì th biomhqanÐa. Sugkekrimèna, mèqri s mera h omda èqei ekd¸sei 6 prìtupa: 13
14
Keflaio 2. To prìtupo 1. MPEG-1:
MPEG
To pr¸to prwtìkollo pou ekdìjhke apì thn epitrop tan
to MPEG-1 kai ekdìjhke to 1992 sto LondÐno. Prìkeitai gia thn pr¸th èkdosh thc omdac kai afor thn anptuxh protÔpwn sumpÐeshc qou kai eikìnac gia thn apoj keush mèswn me rujmì mèqri 1.5 kai poiìthta pou antistoiqeÐ sto prìtupo
VHS.
Mbit/sec
To prwtìkollo eÐnai
qwrismèno se pènte mèrh. Sto pr¸to mèroc parousizei èna prìtupo, to Program Stream(PS),
to opoÐo epitrèpei to sugqronismì kai thn polÔ-
plexh reumtwn qou kai eikìnac. Sto deÔtero mèroc to prìtupo kajorÐzei ènan algìrijmo sumpÐeshc bÐnteo se poiìthta
VHS
kai apìdosh
1,15 Mbit/s qrhsimopoi¸ntac twn algìrijmo sumpÐeshc jpeg gia to kje frame
tou video. Sto trÐto mèroc tou prwtokìllou perigrfetai mia nèa
teqnik sumpÐeshc qou, to
MP3
to opoÐo eÐnai apì ta pio diadedomèna
prìtupa sumpÐeshc qou s mera. To prìtupo autì basÐzetai tìso sth teqnik sumpÐesh dedomènwn
PCM
ìso kai se kpoiec parathr seic thc
epist mhc thc yuqoakoustik c. Sto tètarto mèroc tou prwtokìllou perigrfontai kpoiec mèjodoi elègqou sumbatìthta enìc sust matoc me to prwtìkollo
MPEG- 1.
Tèloc sto pèmpto mèroc tou prwtìkollo
parousizetai èna sÔsthma MPEG-1 ulopoihmèno sth gl¸ssa programmatismoÔ C. To prwtìkollo MPEG1 an kai s mera jewreÐtai xeperasmèno gia thn kwdikopoÐhsh bÐnteo, kpoia mèrh tou qrhsimopoioÔntai se meglo bajmì se kajhmerinèc efarmogèc ìpwc sth dhmiourgÐa
video-cd
kai sth sumpÐesh arqeÐwn qou. 2. MPEG-2:
To deÔtero prwtìkollo pou epikÔrwse h epitrop tan to
MPEG-2.
H pr¸th epÐshmh èkdos tou tan to 1994. To prwtìkollo
autì mac endiafèrei kaj¸c qrhsimopoieÐtai se meglo bajmì sthn efarmog mac. To
MPEG2
sunolik apoteleÐtai apì 11 mèrh, me ta pènte
pr¸ta na èqoun Ðdio jèma me to MPEG-1. Oi kuriìterec diaforèc metaxÔ twn dÔo prwtokìllwn entopÐzontai se 2 kurÐwc shmeÐa sta 5 pr¸ta keflaia. Sto pr¸to mèroc tou, to prwtìkollo
MPEG-2
parousizei
èna nèo prìtupo polÔplexhc kai paketopoÐhshc twn diafìrwn reumtwn enìc mèsou. To prìtupo autì onomzetai
Transport Stream (TS)
kai
stìqo èqei thn apodotikìterh apostol mèswn mèsw tou diadiktÔou,
2.1.
15
MOVING PICTURE EXPERTS GROUP
en¸ parllhla epekteÐnetai to uprqon prìtupo
Program Stream (PS)
epitrèpontac thn apotelesmatikìterh apoj keush reumtwn. Sto deÔtero keflaio tou
MPEG2
pou afor ta prìtupa sumpÐeshc bÐnteo, to
prwtìkollo kajorÐzei mia proèktash tou uprqontoc protÔpou pou epitrèpei thn upost rixh diaplekìmenwn eikìnwn (interlaced images) dunatìthta h opoÐa epitrèpei thn apodotikìterh sumpÐesh. EpÐshc se aut n thn èkdosh h ereunhtik omda parousÐase kpoia nèa keflaia sto prwtìkollo. Sto èkto kai dèkato keflaio parousizetai to prwtìkollo (Digital Storage Media Command and Control),
DSM-CC
to opoÐo epitrèpei th
dhmiourgÐa sunedri¸n metaxÔ enìc pelth kai enìc exuphretht mèswn, kaj¸c kai ton apomakrusmèno èlegqo twn exuphretht¸n. Sto èbdomo keflaio parousisthke èna nèo prìtupo kwdikopoÐhshc qou, to ACC, to opoÐo epitrèpei thn kwdikopoÐhsh poluknalwn reumtwn qou. Tèloc, sto ìgdoo keflaio to prwtìkollo kajorÐzei mejìdouc diaqeÐrishc eikìnwn bÐnteo gia tic opoÐec to qr¸ma anaparÐstatai me perissìtera apì 8 bits
en¸ sto ènato keflaio parousizei mia diepaf anmesa sto Trans-
port Stream
kai ston apokwdikopoiht , pou stìqo èqei na kalÔyei tic
angkec tou
DSM-CC
3. MPEG-4: MPEG-4.
gia th dhmiourgÐa sunedri¸n.
H trÐth èkdosh prwtokìllou apì thn omda
MPEG
tan to
To prwtìkollo autì èqei sunolik 21 keflaia, diathr¸n-
tac bèbaia touc tÐtlouc twn 6 pr¸twn Ðdiouc me autoÔc touc
MPEG-2.
To prwtìkollo autì parousisthke epÐshma to 1998 kai eÐqe wc tÐtlo
“KwdikopoÐhsh optikoakoustik¸n antikeimènwn”. Se genikèc grammèc, h èkdosh aut tou prwtokìllou eÐqe wc prwtarqikì stìqo thn prosj kh thc dunatìthtac kwdikopoÐhshc memonwmènwn antikeimènwn se mÐa parousÐash sta dh uprqonta prwtìkolla. Merikèc apì tic epektseic pou uposthrÐzontai eÐnai h dunatìthta diaqeÐrishc pollapl¸n reumtwn qou me diaforetik kwdikopoÐhsh tou kajenìc kai diaforetik c qrhstikìthta kaj¸c kai h dunatìthta diaqeÐrishc 3D antikeimènwn. EpÐshc prostèjhke ènac mhqanismìc diaqeÐrishc kai prostasÐac dikaiwmtwn, pou prokÔptoun apì memonwmèna antikeÐmena enìc arqeÐou. Tèloc, to prwtìkollo parousÐase kai kpoiouc neìterouc kai apodotikìterouc algorÐjmouc
Keflaio 2. To prìtupo
16
sumpÐeshc qou kai bÐnteo (AVC). To
MPEG-4
rujmoÔc metdoshc dedomènwn mèqri 1
Gbit/s.
4. MPEG-7:
MPEG
mporeÐ poia na kalÔyei
To prwtìkollo autì eÐnai to tètarto prwtìkollo pou ekdìjh-
ke apì thn omda. H melèth tou xekÐnhse ton AprÐlio tou 1997 kai akìma brÐsketai upì anptuxh. ApoteleÐtai sunolik apì 11 keflaia. To MPEG-7
kajorÐzei kpoiec nèec dunatìthtec gia ta paliìtera prwtìkolla
pou stìqo èqoun ton emploutismì touc me dunatìthtec apoj keushc metaplhrofori¸n pou perigrfoun ta dedomèna tou arqeÐou. Ta dedomèna aut upakoÔn se kpoio dedomèno sq ma kai mporoÔn na anafèrontai se eikìnec, se qo kai se aplì keÐmeno. 5. MPEG-21:
To prwtìkollo
MPEG-21
eÐnai to ìrama thc omdac gia to
mèllon ston tomèa twn polumèswn. H anptuxh tou xekÐnhse to Mio
– IoÔnio tou 2000. To MPEG-21 eÐnai èna anoiqtì prwtìkollo pou stìqo èqei thn anptuxh enìc plaisÐou gia ton èlegqo twn dikaiwmtwn se efarmogèc polumèswn. Poio sugkekrimèna to prwtìkollo kajorÐzei èna prìtupo gia mia “Gl¸ssa èkfrashc dikaiwmtwn”(Rights Expression Language) me thn opoÐa mporeÐ na emploutÐzetai kje arqeÐo polumèswn kai h opoÐa kajorÐzei thn deia, ta dikai¸mata kai touc periorismoÔc pou epiblei o dhmiourgìc tou perieqomènou stouc qr stec. Se genikèc grammèc to MPEG-21 prospajeÐ na eisgei tic ènnoiec thc dhmiourgÐac, prìsbashc, thc antallag c kai diaqeÐrishc hlektronik¸n dikaiwmtwn sto shmerinì plaÐsio anptuxhc polumèswn me trìpo o opoÐoc na mh gÐnetai antilhptìc mesa apì touc qr stec. H anptuxh tou protÔpou autoÔ èqei wc kÔrio stìqo th katapolèmhsh thc peirateÐac h opoÐa anaptÔssetai se meglo bajmì apì ta dÐktua Peer to Peer. To prwtìkollo autì brÐsketai akìma upì anptuxh kai stoqeÔei na allxei kat polÔ ton trìpo pou antilambanìmaste tic efarmogèc polumèswn. H omda anptuxhc tou
MPEG
apoteleÐtai tìso apì akadhmaðkoÔc egnws-
mènhc axÐac ìso kai apì ekpros¸pouc thc biomhqanÐac. H anptuxh twn prwtokìllwn gÐnetai mèsa apì anoiqtèc proskl seic gia protseic, oi opoÐec gÐnontai mìno proc ta mèlh thc omdac. Me bsh tic protseic, pou gÐnontai, oi
MPEG-2
2.2.
17
omdec pou èqoun analbei thn anptuxh kpoiou protÔpou proteÐnoun kpoio arqikì keÐmeno to opoÐo mèsa apì suzht seic kai yhfoforÐec katal gei sthn telik dhmosÐeush. H anptuxh bèbaia twn protÔpwn tou
MPEG
dèqetai apì
polloÔc kritik , kaj¸c eÐnai arket kleist diadikasÐa kai ta telik prìtupa den eÐnai eleÔjera se ìlouc touc qr stec, anagkzontac touc endiaferìmenouc na katabloun kpoio posì ston ISO gia na lboun antÐgrafa twn protÔpwn.
2.2 To
MPEG-2
MPEG–2
ìpwc eÐdame kai parapnw kajorÐzei èna prìtupo gia thn polÔ-
plexh enìc perissotèrwn stoiqeiwd¸n reumtwn qou kai bÐnteo, kaj¸c kai llwn dedomènwn, miac parousÐashc se èna perissìtera reÔmata katllhla gia apoj keush metdosh [4]. Oi leptomèreiec gia ton trìpo leitourgÐac thc polÔplexhc tou MPEG–2 kajorÐzontai sto pr¸to keflaio tou prwtokìllou. H qr sh tou protÔpou MPEG–2 gia thn polÔplexhc de apaiteÐ h kwdikopoÐhsh h sumpÐesh twn dedomènwn twn reumtwn na èqei gÐnei sÔmfwna me to prìtupo tou
MPEG–2
all mporeÐ na èqei qrhsimopoihjeÐ opoiosd pote sum-
batìc algìrijmoc sumpÐeshc. Gia pardeima, h sumpÐesh tou reÔmatoc bÐnteo mporeÐ na gÐnei me bsh to prìtupo H.264 to opoÐo eÐnai neìtero tou MPEG–2 kai mac dÐnei kalÔterh poiìthta eikìnac se qamhlìtero rujmì metdoshc, me megalÔterec ìmwc apì thn llh pleur apait seic se
Video Data
Video Encoder
Packetizer
Audio Data
Audio Encoder
Packetizer
Video PES
CPU.
Program Stream MUX
Program Stream (DVD)
Transport Stream MUX
Single Program Transport Stream
Audio PES
Elementary Data Data
Sq ma 2.1: Roèc bÐnteo, qou kai dedomènwn sunduzontai gia na sqhmatÐsoun surmoÔc PS kai TS.
Keflaio 2. To prìtupo
18
MPEG
H diadikasÐa polÔplexhc twn epÐ mèrouc reumtwn akoloujeÐ mia strwmatik prosèggish dÔo epipèdwn kai parousizetai diagrammatik sthn eikìna 2.1.
2.2.1
Pr¸th fsh polÔplexhc
Sthn pr¸th fsh thc diadikasÐac polÔplexhc tou
MPEG–2,
to sÔsthma
pargei èna reÔma pakètwn pou onomzetai suskeuasmèno stoiqei¸dec reÔma (Packetized
Elementary Stream)
ementary Stream).
gia kje stoiqei¸dec reÔma dedomènwn (El-
Se genikèc grammèc èna stoiqei¸dec reÔma eÐnai èna reÔma
sumpiesmènou qou, eikìnac kai apl¸n dedomènwn. Sun jwc, prokÔptei apì thn èxodo kpoiou kwdikopoiht kai ta dedomèna eÐnai apokleistik enìc tÔpou. Ta Stoiqei¸dh reÔmata pou aforoÔn qo eikìna genik eÐnai organwmèna se mondec prìsbashc (access
units).
MÐa monda prìsbashc anaparist mÐa
jemeli¸dh monda kwdikopoÐhshc. Kti tètoio gia to reÔma bÐnteo mporeÐ na eÐnai èna plaÐsio, en¸ gia to reÔma qou mporeÐ na eÐnai kpoia kommti dedomènhc dirkeiac. Kje Elementary stream katal gei se èna MPEG–2 epexergast o opoÐoc sugkentr¸nei ta dedomèna kai dhmiourgeÐ to suskeuasmèno stoiqei¸dec reÔma (Packetized
Elementary Stream).
To reÔma
PES
eÐnai mÐa logik kataskeu
pou eÐnai qr simh mìno stic ulopoi seic tou prwtokìllou kai den mporeÐ na qrhsimopoihjeÐ gia th metdosh apoj keush enìc mèsou. To kje pakèto PES,
pou prokÔptei apì ton epexergast , mporeÐ na poikÐlei wc proc to mège-
joc all de mporeÐ na eÐnai megalÔtero apì 65 epikefalÐda 8
byte
toulqiston. H dom enìc
KB,
PES
en¸ perilambnei kai mÐa
pakètou emfanÐzetai sthn
eikìna 2.2.
Sq ma 2.2: H dom enìc
PES
pakètou.
2.2.
MPEG-2
2.2.2
19
DeÔterh fsh polÔplexhc
Sth deÔterh fsh thc diadikasÐac polÔplexhc ta pakèta se èna perissìtera reÔmata progrmmatoc (Program ma metaforc (Transport
Stream).
PES
sunduzontai
Stream)
se èna reÔ-
Ta dÔo aut reÔmata anaptÔqjhkan gia
na kalÔyoun antÐstoiqa tic angkec dÔo meglwn omdwn gnwst¸n anaptussìmenwn efarmog¸n. 'Etsi enswmat¸noun èna meglo bajmì euelixÐac en¸ tautìqrona epibebai¸noun ìti uprqei dialeitourgikìthta anmesa se diforec ulopoi seic suskeu¸n.
2.2.2.1 Program Stream To reÔma progrmmatoc (Program
Stream)
tou
MPEG-2
eÐnai anlogo tou
str¸matoc sust matoc (system layer) tou MPEG–1. To apotèlesm tou eÐnai o sunduasmìc enìc perissotèrwn reumtwn
PES
pakètwn me koinì metrht
qrìno se èna kai monadikì reÔma. Autì to reÔma dedomènwn qrhsimopoieÐtai sun jwc se peribllonta sqetik me polÔ mikr pijanìthta sflmatoc kai eÐnai katllhlo gia efarmogèc pou asqoloÔntai me epexergasÐa twn plhrofori¸n tou reÔmatoc ìpwc diadrastikèc polumesikèc efarmogèc. Ta pakèta reÔmatoc progrmmatoc eÐnai metablhtoÔ megèjouc. Se aut sun jwc perilambnontai plhroforÐec qronismoÔ oi opoÐec qrhsimopoioÔntai gia na kajorÐsoun apì to sÔsthma mia stajer kajustèrhsh kat th metafor twn pakètwn apì thn eÐsodo tou kwdikopoiht sthn èxodo tou apokwdikopoiht . 'Ena pakèto reÔmatoc progrmmatoc apoteleÐtai apì poll epimèrouc pakèta
PES
ta opoÐa èqoun koinì qrìno. Genik h dom enìc pakètou tou
reÔmatoc progrmmatoc emfanÐzetai kai sthn eikìna 2.2. Blèpoume ìti kje pakèto apoteleÐtai apì mÐa epikefalÐda kai difora PES pakèta. H epikefalÐda èqei mègejoc 15 bytec kai apoteleÐtai apì ta ex c pedÐa:
2.2.2.2 Transport Stream To reÔma metdoshc (Transport
Stream)
sunduzei èna h perissìtera epÐ
mèrouc reÔmata dedomènwn pou basÐzontai se èna perissìterouc metrhtèc
Keflaio 2. To prìtupo
20
MPEG
qrìnou se èna kai monadikì reÔma. To reÔma metdoshc sqedisthke gia qr sh se peribllonta me meglh pijanìthta ljouc, ìpwc apoj keush metdosh se peribllonta me jìrubo. Genik to reÔma metaforc mporeÐ na qrhsimopoihjeÐ se poll epÐpeda se mÐa efarmog polumèswn pou qrhsimopoieÐ str¸ma, kai èqei sqediasteÐ gia apodotik kai eÔkolh ulopoÐhsh tou se efarmogèc pou qrhsimopoioÔn dÐktua uyhl¸n taqut twn. Genik to reÔma metdoshc sqedisthke gia na mporeÐ mia efarmog na ekteleÐ eÔkola kpoiec leitourgÐec. Kpoiec apì autèc tic leitourgÐec eÐnai: Ankthsh enìc mìno sugkekrimènou sumpiesmènou reÔmatoc dedomènwn, apì ta reÔmata pou perilambnei to reÔma metaforc. Exagwg enìc mìno sugkekrimènou sumpiesmènou reÔmatoc dedomènwn, apì ta reÔmata pou perilambnei to reÔma metaforc, kai dhmiourgÐa nèou reÔmatoc pou ja perilambnei mìno to reÔma autì. DhmiourgÐa enìc reÔmatoc metdoshc apì reÔmata progrmmatoc gia th metdosh twn plhrofori¸n se kpoio peribllon me sflmata kai dhmiourgÐa met apì to reÔma metdoshc twn arqik¸n reumtwn progrmmatoc. O surmìc dedomènwn apoteleÐtai apì pakèta. To mègejoc ton pakètwn aut¸n eÐnai stajerì kai Ðso me 188
bytes.
Ta pr¸ta 4
bytes
tou pakètou eÐnai h
epikefalÐda. Aut qwrÐzetai se epimèrouc pedÐa to kje èna apì ta opoÐa prosdÐdei èna qarakthristikì sto pakèto. Ta pedÐa aut eÐnai ta ex c:
Sync Byte
:
8
bit
To pedÐo autì shmatodoteÐ thn arq tou pakètou. EÐnai megèjouc
kai èqei pnta thn tim 0x471 ¸ste na eÐnai dunatì se ènan dèkth
na sugqronisteÐ me ton surmì dedomènwn.
Transport Error Indicator
:
Autì to pedÐo, m kouc enìc bit, eÐnai mia shmaÐa
pou paÐrnei timèc 0 1 anloga en to pakèto perièqei ljh ìqi. To pedÐo paÐrnei tim kat thn dirkeia thc l yhc twn dedomènwn ¸ste na gÐnetai gnwstì ìti èqei prokÔyei sflma kat thn metdosh. 1Ο
συμβολισμός 0x, μπροστά από κάποιον αριθμό, δηλώνει ότι ο αριθμός που ακολουθεί είναι δεκαεξαδικός. ΄Ετσι, για παράδειγμα, το 0x47 είναι ο αριθμός 47 με βάση το 16, ή ο αριθμός 71 στο δεκαδικό σύστημα.
MPEG-2
2.2.
21
Payload Start Indicator
'Allh mÐa shmaÐa, h opoÐa paÐrnei tim 1 ìtan to
:
pakèto perièqei thn arq enìc pakètou PSI PES. 'Otan qrhsimopoioÔntai teqnikèc enjulkwshc, aut h shmaÐa èqei llh antimet¸pish pou ja perigrafeÐ paraktw.
Transport Priority
Autì to pedÐo eÐnai mÐa shmaÐa enìc
:
kai lambnei
bit
thn tim 1, gia na deÐqnei ìti ta dedomèna autoÔ tou pakètou, èqoun megalÔterh proteraiìthta apì ta dedomèna twn upìloipwn mèsa ston surmì.
PID
:
Autì to pedÐo èqei m koc 13 bit. EÐnai èna apì ta shmantikìtera pedÐa, kaj¸c h tim tou orÐzei to eÐdoc tou pakètou. Ta pakèta elègqou tou surmoÔ èqoun sugkekrimènec timèc se autì. EpÐshc, ìla ta pakèta pou perièqoun dedomèna enìc
PES,
prèpei na èqoun thn Ðdia tim , ¸ste na
eÐnai efikt h apomìnws touc apì ton surmì. 'Etsi, eÐnai dunatìn mèsa ston Ðdio surmì, na perièqontai poll progrmmata, ìpwc eÐnai dunat kai h metafor enìc progrmmatoc apì ton èna surmì ston llo.
Transport Scrambling Control
:
Autì to pedÐo èqei mègejoc 2
anafèrei en to pakèto èqei uposteÐ teqnikèc
Adaptation Field Contol
:
2
scrambling
Autì to pedÐo eÐnai m kouc 2
bit
kai
.
bit
kai orÐzei an
met thn kefalÐda akoloujoÔn perissìtera dedomèna elègqou. An to pr¸to
èqei tim 1, tìte akoloujeÐ pedÐo
adaptation.
shmantikèc plhroforÐec pou kratei to pedÐo
adaptation,
bit
Mia apì tic eÐnai to
PCR
(Program Clock Reference) bsei tou opoÐou sugqronÐzontai oi diforec epimèrouc roèc tou surmoÔ metaxÔ touc. To epìmeno
bit
kajorÐzei an
akoloujoÔn dedomèna an to pakèto eÐnai kenì.
Continuity Counter
:
To pedÐo autì èqei m koc 4 bit. Sthn ousÐa eÐnai ènac
metrht c pou auxnetai se kje epìmeno pakèto. Autìc eÐnai qr simoc 2 Στις
τηλεπικοινωνίες είναι σύνηθες, πριν μεταδοθεί μία ροή δεδομένων, να εφαρμόζονται σε αυτήν αλγόριθμοι scrambling ώστε να αλλάξει η σειρά των δεδομένων. Αυτή η τεχνική δεν έχει να κάνει με κρυπτογράφηση, αφού ο σκοπός δεν είναι να καταστήσει τα δεδομένα μη προσβάσιμα, αλλά να τους προσδώσει χρήσιμες τεχνικές ιδιότητες. Αυτό επιτυγχάνεται αντικαθιστώντας ανεπιθύμητες αλληλουχίες (πολλοί άσσοι, πολλά μηδενικά, περιοδικές αλληλουχίες. . . ) με άλλες ΄καλύτερης΄ συμπεριφοράς.
Keflaio 2. To prìtupo
22
MPEG
gia thn anÐqneush sfalmtwn metdoshc sthn seir twn pakètwn.
To reÔma progrmmatoc kai to reÔma metdoshc èqoun sqediasteÐ gia diaforetik eÐdh efarmog¸n. EÐnai dunatìn kai logikì na mporoÔme na metatrèyoume èna eÐdoc reÔmatoc se kpoio llo kaj¸c to èna reÔma den eÐnai uposÔnolo tou llou. Gia th metatrop twn reumtwn mia efarmog mporeÐ na qrhsimopoi sei thn koin dom twn
PES
pakètwn. Bèbaia, oi plhroforÐec
pou perièqontai se èna pakèto tou reÔmatoc progrmmatoc den eÐnai dunatìn na apokthjoÔn mesa apì tic plhroforÐec twn epikefalÐdwn twn pakètwn reÔmatoc metdoshc, all mporoÔn na dhmiourghjoÔn apì kpoia peraitèrw epexergasÐa twn pakètwn.
Sq ma 2.3: H dom enìc
Sto pr¸to keflaio tou prwtokìllou
TS
pakètou.
MPEG-2
idiaÐterh mneÐa gÐnetai kai
gia ton sugqronismì twn diafìrwn reumtwn. H leitourgÐa aut eÐnai arket shmantik afenìc gia th swst anaparagwg twn parousisewn, all
2.2.
MPEG-2
23
parllhla h efarmog mac qrhsimopoieÐ tic plhroforÐec qronismoÔ pou metadÐdontai gia ton upologismì twn qronik¸n stigm¸n kat tic opoÐec oi peltec ja prèpei na na zht soun to epìmeno kleidÐ kruptogrfhshc. Gia to sugqronismì twn epimèrouc reumtwn kje ulopoÐhsh tou prwtokìllou jètei kpoia mègista kat¸flia gia th metdosh kai ankthsh pakètwn, tìso tou reÔmatoc tou progrmmatoc, ìso kai tou reÔmatoc metaforc. Sugkekrimèna, to kat¸fli ja prèpei na kajorÐzei to mègisto epitreptì qrìno pou apaiteÐtai gia th sumpÐesh tou reÔmatoc, thn topik apoj keush, thn polÔplexh, th metdosh thn apoj keush, thn apopolÔplexh, thn apokwdikopoÐhsh kai thn anaparagwg tou reÔmatoc. Gia to lìgo autì loipìn to prwtìkollo kajorÐzei ìti se kje tÔpou pakètou ja prèpei perilambnontai plhroforÐec pou aforoÔn qrìno kai oi opoÐec qrhsimopoioÔntai gia ton upologismì thc kajustèrhshc apì krh se krh. O upologismìc twn qrìnwn gÐnetai me th bo jeia enìc koinoÔ sust matoc mètrhshc qrìnou, to opoÐo onomzetai Rolìi Sust matoc (System
Time Clock).
kje pakèto
PES
Time Stamps).
Me bsh autì to rolìi to prwtìkollo eisgei se
èna pedÐo SfragÐdac Qrìnou ParousÐashc (Presentation
Oi sfragÐdec autèc kajorÐzoun to qrìno anaparagwg c enìc
pakètou me bsei èna rolìi palm¸n 90
kHz.
'Opwc eÐdame kai parapnw to
prwtìkollo anaptÔssei peraitèrw ta ìria metdoshc dedomènwn eisgontac kpoia
extra
pedÐa sta pakèta twn reumtwn, ta opoÐa kajorÐzoun epakrib¸c
touc qrìnouc pou ja prèpei na ftsoun ta dedomèna sto kje epÐpedo tou prwtokìllou. 'Etsi loipìn èqoume to pedÐo anaforc RologioÔ progrmmatoc (Program
Clock Reference)
kai to proairetikì pedÐo Anaforc RologioÔ
Stoiqei¸douc ReÔmatoc (Elementary
Stream Clock Reference)
gia to reÔma
progrmmatoc kai to pedÐo Anaforc RologioÔ Sust matoc (System Reference)
Clock
gia to reÔma metaforc. Ta pedÐa aut kajorÐzoun to mègisto
epitreptì qrìno pou mporeÐ na knei to pakèto mèqri thn eÐsodì tou ston apokwdikopoiht .
24
Keflaio 2. To prìtupo
MPEG
Keflaio 3
DVB
To prìtupo
Ta teleutaÐa dèka qrìnia tou 20ou ai¸na h Amerik (ATSC) kai h IapwnÐa (ISDB) anaptÔssoun th dik touc teqnologÐa pnw ston tomèa thc yhfiak c thleìrashc. Parllhla oriojeteÐtai to 1991 h dhmiourgÐa mÐac Eurwpaðk c omdac anptuxhc, h opoÐa ja katal xei to 1992, sthn dhmiourgÐa enìc protÔpou to opoÐo ja apotelèsei th bsh gia thn anptuxh thc yhfiak c thleìrashc sthn Eur¸ph. To 1993 oloklhr¸netai h idèa, me thn Ðdrush thc oikogèneiac protÔpwn
DVB (Digital Video Broadcasting).
H oikogèneia
aut , eÐqe wc stìqo thc thn paroq uyhloÔ epipèdou uphresi¸n yhfiak c thleìrashc qrhsimopoi¸ntac doruforik, kalwdiak kai epÐgeia mèsa metdoshc. Uiojet¸ntac thn kwdikopoÐhsh kat
MPEG-2
se ìla ta prìtupa,
èqei epiteuqjeÐ h yhfiopoÐhsh programmtwn eikìnac kai qou, h metafor dedomènwn me uyhl taqÔthta, kaj¸c kai h poluplexÐa touc. Ta pio gnwst prìtupa pou apartÐzoun thn oikogèneia DVB, mèqri s mera, eÐnai to
DVB-S (Satellite)
DVB-C (Cable) (Terrestrial)
pou uposthrÐzei th doruforik metdosh, to
to opoÐo uposthrÐzei thn kalwdiak metdosh, to
DVB-T
to opoÐo anafèretai sthn amfÐdromh epÐgeia metdosh kai tèloc
èna nèo prìtupo, to
DVB-H (Handhelds)
to opoÐo prosjètei thn ènnoia tou
kinhtoÔ qr sth sthn epÐgeia yhfiak metdosh. To doruforikì sÔsthma
DVB-S
apì thn oikogèneia protÔpwn miac apodoq c. To
DVB-S
DVB
eÐnai to palaiìtero kai pio diadedomèno kai èqei adiamfisb thta tÔqei pagkìs-
sqedisthke gia na ekmetalleÔetai pl rwc to 25
Keflaio 3. To prìtupo
26
DVB
eÔroc z¸nhc twn doruforik¸n thleoptik¸n anametadot¸n. QrhsimopoieÐ rujmì metaforc twn 54Mbps me diamìrfwsh
QPSK
se sunduasmì me èna sq -
ma dipl c kwdikopoÐhshc kai diemplok c (coding/interleaving). EÐnai to mìno prìtupo apì thn oikogèneia DVB pou èqei tÔqei emporik c efarmog c kai sth q¸ra mac. To kalwdiakì sÔsthma DVB-S.
DVB-C
èqei teqnik, arketèc omoiìthtec me to
H diafor tou ègkeitai sto ìti qrhsimopoieÐ thn apodotikìterh (wc
proc to eÔroc z¸nhc) all kai pio euaÐsjhth se parembolèc diamìrfwsh 64QAM
antÐ gia thn
QPSK.
'Etsi, èna kalwdiakì kanli twn 8
MHz
mporeÐ na
metafèrei 38.5Mbps. Enallaktik, mporeÐ na qrhsimopoihjeÐ QAM ligìterwn perissìterwn epipèdwn. Se kje perÐptwsh, uprqei mÐa antistjmish metaxÔ taqÔthtac kai axiopistÐac. To epÐgeio sÔsthma DVB-T apoteleÐ to teleutaÐo qronik mèloc thc oikogèneiac
DVB.
Epitugqnei yhfiak metdosh uyhl¸n taqut twn pnw apì to
dÔskolo epÐgeio kanli, qrhsimopoi¸ntac diamìrfwsh pollapl¸n ferìntwn sto sq ma thc poluplexÐac me orjogwnik diaÐresh suqnìthtac (Orthogonal Frequency Division Multiplexing - OFDM).
To sq ma
OFDM
tou
DVB-T
qrhsimopoieÐ èna meglo arijmì ferìntwn (6817 1704 gia metdosh 8K kai 2K antÐstoiqa), kje èna apì ta opoÐa diamorf¸netai kat
64QAM.
QPSK, 16QAM
'Etsi, h plhroforÐa katanèmetai omoiìmorfa sto fsma kai se
sunduasmì me kwdikopoÐhsh kai diemplok dÔo strwmtwn, to s ma apokt meglh eurwstÐa akìmh kai se peribllonta me isqurèc dial yeic kai fainìmena poludiadromik c metdoshc (multipath). To epÐgeio sÔsthma
DVB-H,
apoteleÐ sunèqeia tou
DVB-T
me th diafor
ìmwc ìti anafèretai se kinhtoÔc qr stec. To prìtupo autì èqei prosarmosteÐ stic idiìthtec pou èqoun oi suskeuèc kinht c prìsbashc, ìpwc mègejoc suskeu c kai qwrhtikìthta mn mhc, angkh eÔkolhc prìsbashc sto dÐktuo kai exoikonìmhsh enèrgeiac. Sthn ousÐa dhmiourgeÐtai mÐa gèfura pou en¸nei ta dÐktua euruzwnik c ekpomp c me ton kìsmo twn kuyelwt¸n asurmtwn diktÔwn.
3.1. LEITOURG'IA KAI EFARMOG'H TOU PROT'UPOU
3.1
DVB-T
27
LeitourgÐa kai efarmog tou protÔpou DVB-T
To prìtupo
DVB-T
eÐnai to pio prìsfato kai pio exeligmèno teqnologik
prìtupo. H qr sh tou sthn epÐgeia yhfiak metdosh, ulopoieÐtai se ìlo kai perissìterec eurwpaðkèc q¸rec. AnaptÔqjhke, ìpwc kai ta upìloipa proanaferjènta
standards,
apì to
DVB Forum
kai egkrÐjhke apì ton or-
ganismì ETSI wc to basikì paneurwpaðkì prìtupo to 1997. To pr¸to epÐgeio prìgramma se yhfiak morf , xekÐnhse sthn AgglÐa èna qrìno argìtera. S mera, sust mata
DVB-T
ulopoioÔntai sthn Eurwpaðk 'Enwsh, th RwsÐa,
thn Anatolik Eur¸ph, thn IndÐa, thn SigkapoÔrh kai thn AustralÐa. To DVB-T
proporeÔetai tou antÐstoiqou ameriknikou protÔpou ATSC, to opoÐo
kai anaptÔqjhke stic Hnwmènec PoliteÐec, wc proc kpoia qarakthristik (kinhtikìthta qr sth, antoq se prìtupo
ISDB-T
multipath,
dhmiourgÐa
SFN),
basÐsthke ousiastik sth filosofÐa tou
Oi prooptikèc qr shc tou gia metdosh dedomènwn
IP
en¸ to Iapwnikì
DVB-T.
eÐnai polurijmec.
Shmantikì pleonèkthma tou epÐgeiou sust matoc eÐnai ìti den apaiteÐ idiaÐtero exoplismì apì pleurc qr sth (p.q. doruforikì dèkth kalwdiak upodom ) en¸ apì thn pleur tou paroqèa, apoteleÐ thn pio prosit kai pio euèlikth lÔsh se sqèsh me thn angkh doruforik c metdoshc th qr sh kalwdiakoÔ diktÔou. 'Ena polÔ shmantikì qarakthristikì tou sugkekrimènou protÔpou, eÐnai h dunatìthta prosj khc enìc epÐgeiou yhfiakoÔ sust matoc se perioqèc kluyhc me kuyelwt dom . Prosfèrei uphresÐec kai se kinoÔmenouc qr stec, mÐa dunatìthta pou oi upìloipec teqnologÐec den eÐnai se jèsh na prosfèroun akìma. Kaj¸c to
DVB-T
orÐzei apì mìno tou èna sÔsthma ekpomp c eureÐac
kluyhc (broadcasting) paraleÐpontac ton orismì thc teqnologÐac epistrof c (reverse
path)
kai dedomènou ìti h morf tou s matoc basik c z¸nhc kai o
algìrijmoc sumpÐeshc thc eikìnac perigrfetai sthn prodiagraf
MPEG-2,
to prìtupo DVB-T periorÐzetai apokleistik sthn perigraf twn leitourgi¸n tou diamorfwt . O diamorfwt c, dèqetai sthn eÐsodo tou apì ton poluplèkth, èna surmì metaforc
MPEG-2,
pou perièqei poluplegmènec tic uphresÐec
eikìnac, qou kai dedomènwn upì morf s matoc basik c z¸nhc kai pargei to
Keflaio 3. To prìtupo
28
RF
DVB
s ma to opoÐo eÐnai ètoimo proc apostol . To teleutaÐo èqei eÔroc z¸nhc
8MHz kai topojeteÐtai se èna apì ta kanlia 21-69 thc mpntac twn
UHF,
ìpwc akrib¸c èna analogikì thleoptikì kanli. O diamorfwt c
DVB-T
qrhsimopoieÐ sq ma
OFDM
gia na antimetwpÐsei
sth metdosh dial yeic epilektikèc wc proc th suqnìthta. Autì to qarakthristikì tou
OFDM
dieukolÔnei polÔ th l yh dedomènwn eureÐac z¸nhc kai
apì kinhtoÔc qr stec. Sto q¸ro mlista twn teqnologi¸n ekpomp c (broadcasting),
to
OFDM
parèqei th dunatìthta kataskeu c diktÔwn me diespar-
mènouc pompoÔc pou ekpèmpoun sugqronismèna ta Ðdia dedomèna sthn Ðdia suqnìthta qwrÐc h sumbol twn shmtwn touc na ephrezei shmantik to dèkth. Tètoia dÐktua onomzontai
Single Frequency Networks (SFN)
kai m-
poroÔn na aux soun thn sunolik qwrhtikìthta tou diktÔou se olìklhrh thn gewgrafik epikrteia mèqri kai 45 forèc. Kaj¸c exaleÐfetai h angkh na uprqoun eleÔjera kanlia se orismènec perioqèc, apofeÔgontai parembolèc me geitonikoÔc pompoÔc. To prìtupo DVB-T sunduzei to OFDM me sÔnjetec teqnikèc isostjmishc kai kwdikopoÐhshc, eisgontac thn teqnologÐa tou kwdikopoihmènou (Coded
OFDM- COFDM).
OFDM
Sunduzontac kwdikopoÐhsh kai diemplok dÔo
epipèdwn, h diadikasÐa diamìrfwshc kajist to s ma idiaÐtera anjektikì se poludiadromik didosh kai parembolèc. H leitourgÐa tou diamorfwt eÐnai sqetik sÔnjeth. Prokeimènou na gÐnei katanoht , ja anaferjoÔn kai ja analujoÔn ta stdi thc xeqwrist. Oi leitourgÐec autèc, me th seir pou efarmìzontai sto ReÔma Metaforc, eÐnai oi ex c: Prosarmog
MPEG-2
pakètwn kai tuqaiopoÐhsh (randomization)
Exwterik kwdikopoÐhsh (prostasÐa ènanti laj¸n me k¸dika Reed-Solomon)
Exwterik suneliktik diemplok (convolutional
interleaving)
Eswterik kwdikopoÐhsh me ditrhto suneliktikì k¸dika (punctured convolutional code)
Eswterik diemplok (inner interleaving) ston qrìno kai sth suqnìthta
3.2. ST'ADIA DIAM'ORFWSHS
DVB-T
29
AntistoÐqhsh kai diamìrfwsh twn ferìntwn PoluplexÐa kat (IFFT)
OFDM
me antÐstrofo taqÔ metasqhmatismì
kai diamìrfwsh tou fèrontoc
Fourier
IF
'Anw metatrop (up-conversion) sthn telik
RF
suqnìthta.
H teleutaÐa leitourgÐa den uposthrÐzetai eggen¸c apì arketoÔc diamorfwtèc. Ja prèpei na eisaggoume mÐa prìsjeth monda gia nw metatrop . Sthn perÐptwsh thc ierarqik c diamìrfwshc, to s ma basik c z¸nhc proôprqei diairemèno se dÔo ReÔmata Metaforc: èna uyhl c proteraiìthtac (high
priority TS)
kai èna qamhl c (low
f¸nontai tautìqrona se èna ierarqikì
priority TS).
QAM
Ta dÔo s mata diamor-
s ma. Wc apotèlesma, ènac dèk-
thc me kakèc sunj kec l yhc lambnei mìno ta dedomèna uyhl c proteraiìthtac, en¸ ènac me kalÔterec lambnei to sÔnolo. H leitourgÐa ierarqik c diamìrfwshc parèqei shmantik euelixÐa sto sÔsthma, idÐwc ìtan sunodeÔetai apì klimakwt kwdikopoÐhsh thc kinoÔmenhc eikìnac kat
MPEG-2
(scalable
MPEG-2 encoding).
Prokeimènou na gÐnei katanohtìc o trìpoc metdoshc twn uphresi¸n, perigrfontai paraktw ta b mata pou akoloujeÐ aut h yhfiak metdosh. Gia thn kwdikopoÐhsh twn thleoptik¸n all kai twn hqhtik¸n shmtwn kaj¸c kai gia thn poluplexÐa qrhsimopoieÐtai to krÐneia kai ristoc qoc. 'Enac surmìc metaforc
MPEG-2.
MPEG-2,
Apìluth eu-
mporeÐ praktik
na metafèrei otid pote eÐnai dunatì na yhfiopoihjeÐ.
3.2
Stdia diamìrfwshc DVB-T
3.2.1
Prosarmog
MPEG-2 pakètwn kai tuqaiopoÐ-
hsh To s ma basik c z¸nhc pou eisèrqetai ston diamorfwt eÐnai stajeroÔ rujmoÔ (constant 188
bit rate - CBR)
bytes.
kai organwmèno se pakèta stajeroÔ m kouc twn
Kje pakèto xekin me to
byte
sugqronismoÔ, pou eÐnai pnta
Ðso me 0x47. Prokeimènou na perioristeÐ to endeqìmeno na uprqoun megla
Keflaio 3. To prìtupo
30
DVB
diast mata qwrÐc duadik metabol (makrièc akoloujÐec 0 1 - kti pou sumbaÐnei p.q. se pakèta kenoÔ perieqomènou pou qrhsimopoioÔntai mìno gia stung),
akoloujeÐtai mia diadikasÐa tuqaiopoÐhshc, ìpwc faÐnetai kai sto
paraktw sq ma. To polu¸numo gia thn genn tria yeudotuqaÐac akoloujÐac eÐnai:
1 + X 14 + X 15
3.2.2
Exwterik kwdikopoÐhsh kai suneliktik diemplok
Sth sunèqeia, pragmatopoieÐtai exwterik kwdikopoÐhsh (outer coding) h opoÐa kaleÐtai kwdikopoÐhsh
Reed Solomon.
Kat th dirkeia thc exwterik c k-
wdikopoÐhshc gÐnetai qr sh miac teqnik c pou onomzetai Emprìsjia ∆iìrjwsh Sfalmtwn, FEC (Forward Error Correction). SÔmfwna me thn teqnik aut , se kje pakèto metaforc twn 188
bytes,
prostÐjentai 16
bytes
pleonasmoÔ,
opìte prokÔptei èna pakèto prostateumèno apì sflmata, m kouc 204
bytes.
AkoloujeÐ h teqnik thc suneliktik c diemplok c, skopìc thc opoÐac eÐnai h aÔxhsh thc apìdoshc thc kwdikopoÐhshc
Reed-Solomon.
O lìgoc gia
ton opoÐo apaiteÐtai apodotikìterh prostasÐa ènanti sta sflmata, eÐnai ìti sta kanlia metdoshc h poiìthta twn shmtwn metablletai kai eÐnai dunatìn ènac megloc arijmìc apì duadik yhfÐa, o opoÐoc uperbaÐnei thn dunatìthta diìrjwshc thc kwdikopoÐhshc RS, na alloiwjeÐ (apì pijanì qtÔphma keraunoÔ apì parembolèc hlektrik¸n suskeu¸n). H prostasÐa kje pakètou metdoshc apì tètoiou eÐdouc alloi¸seic den eÐnai idiaÐtera oikonomik . Se aut n thn perÐptwsh efarmìzetai suneliktik diemplok , sÔmfwna me thn opoÐa ta dedomèna afoÔ kwdikopoihjoÔn me thn Emprìsjia ∆iìrjwsh Sfalmtwn, trofodotoÔntai se mia mn mh
RAM
kai metadÐdontai anadiatetagmèna (mia pijan
ekdoq eÐnai ta dedomèna na eisèrqontai sth RAM se grammèc kai na exèrqontai se st lec). Me th qr sh miac deÔterhc
RAM
kat th l yh, ta dedomèna
topojetoÔntai sthn arqik touc dom . To apotèlesma thc diadikasÐac thc diemplok c eÐnai ìti to susswmtwma twn duadik¸n yhfÐwn pou èqoun uposteÐ sflma metatrèpetai se èna meglo arijmì eniaÐwn esfalmènwn sumbìlwn, ta
3.2. ST'ADIA DIAM'ORFWSHS
DVB-T
31
opoÐa eÐnai eÔkola diorj¸sima.
3.2.3
Eswterik kwdikopoÐhsh kai diemplok
H eswterik kwdikopoÐhsh akoloujeÐ th suneliktik diemplok kai th sumplhr¸nei apodotik kaj¸c diorj¸nei llou eÐdouc sflmata. O isqurìc pleonasmìc pou eisgetai apì aut (100%, kaj¸c o suneliktikìc kwdikopoiht c pargei dÔo roèc exìdou, kajemi me ton Ðdio rujmì metdoshc ìpwc h ro eisìdou) epitrèpei mia polÔ isqur diìrjwsh laj¸n. Autì mporeÐ na eÐnai anagkaÐo gia s mata me polÔ qamhlì lìgo s matoc-proc-jìrubo (SNR, ratio)
signal-to-noise
sthn eÐsodo tou dèkth, all èqei wc apotèlesma ton upodiplasiasmì
thc fasmatik c apìdoshc tou kanalioÔ. Wstìso, autoÔ tou tÔpou h suneliktik kwdikopoÐhsh, epitrèpei o pleonasmìc pou eisgetai, na meiwjeÐ diamèsou thc ditrhshc (puncturing) thc exìdou tou suneliktikoÔ kwdikopoiht . Autìc kajist dunat th mh l yh ìlwn twn diadoqik¸n bits twn akolouji¸n exìdou, all mìno èna apì ta dÔo tautìqrona bitc me èna sugkekrimèno lìgo ditrhshc (puncturing ratio). Me autì ton trìpo, eÐnai pijanì na epiteuqjoÔn oi rujmoÐ k¸dika ditrhshc (punctured DVB
code rates)
pou kajorÐzontai apì to stntar
(2/3, 3/4, 5/6 7/8), pou ekfrzoun to lìgo thc eisìdou proc ton
ekpempìmeno rujmì (sthn èxodo). ∆edomènhc thc isqÔoc tou anametadìth kai tou megèjouc thc keraÐac l yhc, o rujmìc k¸dika pou epilègetai apì to stajmì ekpomp c ja apoteleÐ èna sumbibasmì metaxÔ enìc epijumhtoÔ rujmoÔ metdoshc kai tou tÔpou thc pareqìmenhc uphresÐac.
3.2.4
∆iamìrfwsh kai metdosh
H diadikasÐa thc eswterik c diemplok c pargei mia akoloujÐa apì h organwmènh se sÔmbola ta diamìrfwshc eÐnai:
QAM.
bits
'Opwc proanafèrjhke, ta dunat sq ma-
QPSK (2 bits/symbol), 16QAM (4 bits/symbol)
64QAM (6 bits/symbol).
d-
Ta diagrmmata asterismoÔ
kai
(constellation maps)
gia kje tÔpo diamìrfwshc perigrfontai analutik sthn prodiagraf . Ta sÔmbola omadopoioÔntai kai metadÐdontai tautìqrona me th qr sh poluplexÐac OFDM. e)
Kje sÔmbolo OFDM apoteleÐtai apì èna sÔnolo N=6817 (8k mod-
1705 (2k
mode)
ferìntwn kai metadÐdetai me dirkeia
TS=896msec
kai
Keflaio 3. To prìtupo
32
TS=224msec
DVB
antÐstoiqa. H apìstash metaxÔ dÔo geitonik¸n ferìntwn eÐnai
∆f=1116Hz kai ∆f=4464Hz gia tic dÔo katastseic leitourgÐac antÐstoiqa. H orjogwniìthta metaxÔ twn ferìntwn exasfalÐzetai apì to gegonìc ìti ∆f=1/TS pnta. Me th sunj kh aut , h ditaxh twn ferìntwn apokt th morf tou paraktw sq matoc.:
Sq ma 3.1:
DVB
diamorfomèno s ma.
To sunolikì eÔroc z¸nhc tou s matoc DVB-T anèrqetai sta 7.61MHz gia onomastik katstash leitourgÐac 8 leitourgÐac twn 7 kai 6
MHz.
MHz,
To kje sÔmbolo
dÔo mèrh: èna wfèlimo tm ma me dirkeia (guard
interval),
me dirkeia
D.
en¸ problèpontai kai katastseic TU
OFDM
apoteleÐtai apì
kai èna disthma froÔrhshc
To disthma froÔrhshc apoteleÐtai apì mia
kuklik epanlhyh tou wfèlimou tm matoc, kai eisgetai prin apì autì. 68 diadoqik sÔmbola
OFDM
apoteloÔn èna plaÐsio
OFDM
(OFDM
en¸ tèssera diadoqik plaÐsia apoteloÔn èna upèr-plaÐsio (OFDM frame).
frame), super-
Mèsa se kje sÔmbolo OFDM, oi plhroforÐec pou metafèrontai apì
ta fèronta mporeÐ na eÐnai eÐte dedomèna eÐte plhroforÐec sugqronismoÔ kai genik¸c dedomèna qr sima gia thn kal leitourgÐa tou dèkth. Ta fèronta pou den fèroun plhroforÐa diakrÐnontai se:
3.2. ST'ADIA DIAM'ORFWSHS
DVB-T
33
∆iesparmèna fèronta-pilìtouc (pilot carriers). Aut ekpèmpoun ek peritrop c èna dedomèno s ma, to opoÐo gnwrÐzei o dèkthc. Metr¸ntac thn isqÔ twn ferìntwn aut¸n, o dèkthc mporeÐ an psa stigm na sqhmatÐsei mia ektÐmhsh thc apìkrishc suqnìthtac (frequency
response)
tou
kanalioÔ.
Stajer fèronta-pilìtouc. Aut katèqoun stajer jèsh mèsa sto sÔmbolo.
Fèronta shmatodosÐac paramètrwn metdoshc (TPS rameter Signalling carriers).
-Transmission Pa-
Aut katèqoun epÐshc stajer jèsh mèsa
sto sÔmbolo, kai plhroforoÔn to dèkth gia tic paramètrouc pou qrhsimopoioÔntai sth metdosh (rujmìc kwdikopoÐhshc, dirkeia diast matoc froÔrhshc, tÔpoc diamìrfwshc), oÔtwc ¸ste o dèkthc na mporeÐ na prosarmìzetai autìmata.
3.2.5
Wfèlimo
bit rate
H tim pou perissìtero Ðswc endiafèrei ton paroqèa bit rate
DVB-T
eÐnai to wfèlimo
pou mporeÐ na metaferjeÐ apì to yhfiakì s ma, dhlad o rujmìc tou
ReÔmatoc Metaforc MPEG-2 pou metadÐdetai. H tim aut exarttai apì th dirkeia tou diast matoc froÔrhshc, ton rujmì kwdikopoÐhshc kai ton tÔpo thc diamìrfwshc, ìpwc faÐnetai kai ston akìloujo pÐnaka (timèc se
Mbps).
O sunduasmìc twn paramètrwn pou ja qrhsimopoihjoÔn brÐsketai sthn epilog tou qr sth. Genik pntwc isqÔei ìti ìso auxnei o wfèlimoc rujmìc, tìso pio eulwto gÐnetai to s ma se fainìmena dialeÐyewn kai poludiadromik c metdoshc (multipath). ApaiteÐtai dhlad na gÐnei ènac sumbibasmìc (tradeo)
apì thn pleur tou paroqèa metaxÔ qwrhtikìthtac kai anjektikìthtac
tou s matoc.
Keflaio 3. To prìtupo
34
3.3
DVB
Metdosh IP dedomènwn pnw apì to kanli DVB-T
'Opwc anafèrjhke èna qarakthristikì tou prìtupou wsh twn pakètwn bytes
IP
DVB-T
eÐnai h enjulk-
sta pakèta metaforc. Ta pakèta èqoun m koc 188
qrhsimopoi¸ntac tèssera apì aut wc
enswmtwsh twn pakètwn
sto
IP
TS
header(epikefalÐda).
Gia thn
kai gia na diakrijoÔn apì ta yhfiak
pakèta thleoptik¸n programmtwn qreiazìmaste mia diadikasÐa pou ja ektelèsei th leitourgÐa thc qartogrfhshc, thn prosarmog kai thn kattmhsh, autèc oi leitourgÐec orÐzontai apì to prìtupo ETSI EN 301 192 (Digital Video Broadcasting (DVB): DVB
prodiagraf gia ekpomp dedomènwn) [ 7 ]. Autì
to prìtupo kajorÐzei tèsseric teqnikèc enjulkwshc. Teqnik swl nwshc stoiqeÐwn (Data piping technique). Aut h teqnik epitrèpei sta pakèta IP dedomènwn na enswmatwjoÔn wc wfèlimo fortÐo sta pakèta dedomènwn
MPEG-2 TS.
Ro dedomènwn (Data f¸netai me èna sumbatì
Streaming) MPEG-2
ìpou to reÔma dedomènwn diamor-
stoiqei¸dec reÔma to opoÐo apì kje
strof organ¸netai se pakèta akolouj¸ntac thn dom Paketarismèno Stoiqei¸dec ReÔma (PES). Telik ta anèmontai sto
MPEG-2
PES
pakèta temaqÐzontai kai di-
wfèlimo fortÐo pakètwn metaforc.
Enjulkwsh poluprwtokìllwn (Multiprotocol
Encapsulation).
h teqnik epitrèpei th metafor diforwn prwtokìllwn (p.q. mèsw tou kanalioÔ
DVB
Aut
TCP/IP)
èqontac enswmat¸sei ta pakèta dedomènwn se
tm mata dedomènwn ìpwc kajorÐzontai sto prìtupo MPEG-2 DSM-CC. Aut ta tm mata dedomènwn eÐnai sumbat sto private section pou kajorÐzetai sto at ISO/IEC 13818-1 kai mporoÔn na enswmatwjoÔn apeujeÐac sto
TS.
Gia th dikrish aut¸n twn pakètwn qrhsimopoioÔme ènan
arijmì tautìthtac pakètou (PID) , to pedÐo MAC kai thn IP dieÔjunsh. Ippodrìmio dedomènwn (Data Carousel). Aut h teqnik eÐnai katllhlh gia mh-amfÐdromh metdosh dedomènwn en¸ ta metadidìmena dedomèna eÐ-
3.4. AMFIDROMIK'OTHTA
35
nai sun jwc stìqoc se meglh omda qrhst¸n. Ta dedomèna ippodromÐou metadÐdontai kat mia periodik analogÐa.
3.4
Amfidromikìthta
Apì to 2001 kai met up rqe diquth mÐa tsh sthn episthmonik koinìthta na uprxei dunatìthta, ektìc apì thn ekpomp optikoakoustikoÔ ulikoÔ, ekpomp c dedomènwn mesw tou
DVB
kai paroq c amfÐdrom¸n diadrastik¸n
uphresi¸n. 'Etsi anaptÔqjhkan prìtupa gia dhmiourgÐa amfidromìthtac sto DVB (DVB-RCS, DVB-RCT).
Oi basikoÐ stìqoi thc AmfÐdromhc Dianom c eÐnai h enopoÐhsh twn teqnologi¸n (GSM, DVB, LMDS, UMTS klp) kai h epèktash thc paroq c uphresi¸n polumèswn se kinoÔmenouc qr stec, dedomènhc thc eureÐac perioq c kluyhc pou parèqei h yhfiak thleìrash. Akìma ènac apì touc shmantikìterouc stìqouc eÐnai h kajolik qr sh
IP
gia ìlec tic uphresÐec, kaj¸c eÐnai poll
ta ofèlh miac tètoiac omoiogèneiac sthn metdosh.
36
Keflaio 3. To prìtupo
DVB
Keflaio 4
H mèjodoc enjulkwshc
To
ULE (Unidirectional Lightweight Encapsulation)
ULE
eÐnai èna prwtìkollo
enjulkwshc sto epÐpedo diasÔndeshc to opoÐo protupopoieÐ thn metafor pakètwn epipèdou diktÔou, ìpwc gia pardeigma 2
IP datagrams,
surm¸n dedomènwn. Ex aitÐac tou polÔ mikroÔ
overhead
mèsw
MPEG-
pou apaiteÐ eÐnai
idiaÐtera katllhlo gia efarmogèc IP over Satellite ìpou èqei meglh shmasÐa h exoikonìmhsh eÔrouc z¸nhc. 'Enac akìmh lìgoc pou mporeÐ na protimhjeÐ aut h mèjodoc enjulkwshc, eÐnai to gegonìc ìti eÐnai shmantik eukolìtero na analujeÐ kai na uposteÐ epexergasÐa apì llec enallaktikèc (p.q. Epeid aut h mèjodoc enjulkwshc èqei wc bsh to
MPE).
MPEG-2,
eÐnai
katllhlh gia na enswmatwjeÐ sthn arqitektonik tou DVB prosfèrontac ètsi èna monìdromo (simplex) kanli epikoinwnÐac. To ULE èqei upost rixh gia epÐgeia (DVB-T), doruforik (DVB-S) kai kalwdiak (DVB-C) thleìrash. Mèsw aut¸n twn protÔpwn mporoÔn epÐshc na dhmiourghjoÔn dikateujhntika (duplex) kanlia afoÔ sto DVB proteÐnontai poll eÐdh kanali¸n epistrof c ìpwc duo drìmwn
satellite links (ETSI-RCS)
kai
dial-up modem links (R-
FC3077).
4.1
Qarakthristik
To
perigrfetai sto
ULE
den èqei gÐnei
standard.
RFC 4326 [3]
thc
IETF.
Mèqri s mera (2007)
To prìtupo perigrfei ènan mhqanismì enjulkwshc 37
Keflaio 4. H mèjodoc enjulkwshc
38
o opoÐoc kajist dunat thn metafor
IPv4
kai
IPv6
ULE
dedomenografhmtwn
kaj¸c kai pakètwn llwn diktuak¸n prwtokìllwn kateujeÐan pnw ston MPEG-2
surmì metaforc me thn morf
TS Private Data.
To
RFC
4326
prodiagrfei thn basik morf thn enjulkwshc h opoÐa uposthrÐzei mia morf epèktashc pou epitrèpei, mèsw epiprìsjethc plhroforÐac sthn kefalÐda, epauxhmènh leitourgikìthta.
Sq ma 4.1: Mia tupik morf enìc
H mèjodoc thc
ULE
SNDU.
enjulkwshc mporeÐ na analujeÐ se trÐa basik st-
dia. Arqik prèpei na dhmiourg soume me kpoion trìpo na anakt soume thn plhroforÐa pou ja epexergastoÔme. Aut uprqei sthn morf pakètwn epipèdou diktÔou, ìpwc gia pardeigma plaÐsia Ethernet kai IP dedomenograf mata. Ta pakèta aut, ta opoÐa onomzoume PDUs (Protocol Data Units), odhgoÔntai sthn eÐsodo tou enjulakwt . Sthn sunèqeia o enjulakwt c morfopoieÐ kje PDU se èna pakèto SNDU (SubNetwork Data Unit)
to opoÐo kai apoteleÐ èna
ULE
pakèto. H mor-
fopoÐhsh kje pakètou perilambnei thn prosj kh thc kefalÐdac enjulkwshc prin to PDU kai sto tèloc mia akoloujÐa elègqou akeraiìthtac tessrwn Bytes.
O èlegqoc akeraiìthtac epitugqnetai me ènan algìrijmo
CRC32
me
ta qarakthristik pou perigrfontai sto prìtupo. AfoÔ èqei kataskeuasteÐ kai to
SNDU
den mènei par na katakermatis-
jeÐ ¸ste na moirasteÐ sto wfèlimo fortÐo enìc perissotèrwn
MPEG-TS
pakètwn. O surmìc pou dhmiourgeÐtai ètsi mporeÐ na enswmatwjeÐ se èna logikì kanli enìc p c
DVB
TS
surmoÔ kai na ton akolouj sei se mia alusÐda ekpom-
ètsi ¸ste na ftsei ston telikì qr sth. EkeÐ, akolouj¸ntac thn
4.1. QARAKTHRISTIK'A
39
antÐstrofh diadikasÐa, mporoÔme na anakt soume thn ro pakètwn pou me thn mèjodo thc
ULE
enjulkwshc eÐqame sumperilbei sto ekpempìmeno
DVB
s ma. Me aut n thn teqnik kat nou ja prèpei na eÐnai profanèc ìti me aut n thn apl diadikasÐa ja mporoÔse kaneÐc na persei pnw apì èna opoiod pote dÐktuo
DVB
dedomèna me thn morf diktuak c kÐnhshc. An t¸ra gÐnei qr sh
kai enìc kanalioÔ epistrof c, tìte mporoÔme na prosfèroume ston telikì qr sth mia aperiìristh gkma amfÐdromwn, pragmatik diadrastik¸n uphresi¸n. Akìma mporoÔme na qrhsimopoi soume to dÐktuo tou backbone T
san èna
dÐktuo afoÔ gia pardeigma se mia pìlh ìpou èqw ekpomp
o rujmìc dedomènwn pou ekpèmpetai mèsw twn
Gbps,
DVB
UHF
DVB-
eÐnai thc txhc twn 2
mia diìlou eukatafrìnhth posìthta gia ta dedomèna miac mèshc pìlhc.
Sq ma 4.2: To digramma leitourgÐac enìc
ULE
enjulakwt .
Keflaio 4. H mèjodoc enjulkwshc
40
4.2
SÔgkrish
Stic mèrec mac h kÔria mèjodoc enjulkwshc dedomènwn TS
ULE
IP
se ènan
MPEG2-
surmì, ¸ste na mporeÐ na ekpemfjeÐ mèsw miac platfìrmac yhfiak c
thleìrashc, eÐnai h sqedÐash tou over DVB
MPE
MPE (Multi Protocol Encapsulation).
Parolaut h
apodeiknÔetai ìti den eÐnai h idanik gia efarmogèc
IP
kaj¸c qrhsimopoieÐ poll plhroforÐa h opoÐa den qreizetai me
apotèlesma na èqoume spatlh eÔrouc z¸nhc.
Sq ma 4.3: To
T¸ra to
ULE
ULE
kai to
MPE
sta epÐpeda tou
DVB.
proteÐnetai san nèa enallaktik mèjodoc ènanti tou
MPE,
prosfèrontc mac aploÔsteush, auxhmènh apìdosh kai parametropoÐhsh. Autì èqei epibebaiwjeÐ kai me apeujeÐac metr seic se platfìrma
DVB
¸ste na
epibebaiwjeÐ h jewrÐa [2, 3, 5]. To ULE se sÔgkrish me to MPE mporeÐ na epitÔqei megalÔterec taqÔthtec metdoshc wfèlimhc plhroforÐac gia orismènec efarmogèc. Autì ofeÐletai sto shmantik mikrìtero overhead pou apaiteÐ gia thn metdosh kai eÐnai fanerì
4.3. UPOST'HRIXH
41
RTP/AMR Overhead MPE Padded MPE Packed MPE/LLC ULE+D ULE Bridged MPE Bridged ULE
PÐnakac 4.1: To
overhead
71% 23% 31% 21% 13% 41% 29%
pou apaiteÐtai gia orismèna eÐdh metadìsewn.
kai apì ton pÐnaka 4.1. 'Etsi se pollèc uphresÐec ìpou h exoikonìmhsh eÔrouc z¸nhc eÐnai meÐzonoc shmasÐac to
4.3
ULE
eÐnai protimìtero apì to
MPE.
Upost rixh
An kai gÔrw apì to
ULE
uprqei shmantik èreuna se exèlixh kai arketì
endiafèron, akìma den èqei gÐnei
standard
lìgw tou ìti h emfnis tou sthn
episthmonik koinìthta (RFC 4342) eÐnai sqetik prìsfath. Autì èqei wc apotèlesma na mhn uprqei h aparaÐthth teqnognwsÐa kai poikilÐa ètoimwn lÔsewn ulikoÔ akìma. Parìla aut o pur nac tou kai met uposthrÐzei
out-of-the-box
to
ULE.
Linux
dh apì to 2002
'Etsi ston tomèa twn dekt¸n
uprqei sqedìn kajolik upost rixh afoÔ opoiad pote platfìrma mporeÐ na trèxei
Linux.
42
Keflaio 4. H mèjodoc enjulkwshc
ULE
Keflaio 5
Sqediasmìc
5.1
Apait seic ulikoÔ
Se mia pr¸th prosèggish tou probl matoc mporeÐ kaneÐc na katal xei se mÐa skiagrfhsh twn apait sewn apì pleurc ulikoÔ. Ac doÔme pwc analÔetai to prìblhma stic sunist¸sec tou. Kat' arq n ènac qr sthc o opoÐoc epijumeÐ na steÐlei diktuak dedomèna mèsw yhfiak c thleìrashc prèpei ta dedomèna tou na apokt soun prìsbash sthn alusÐda ekpomp c ¸ste na mporèsoun na metadojoÔn. Autì mac odhgeÐ sthn apaÐthsh Ôparxhc enìc kìmbou o opoÐoc èqei dunatìthta epikoinwnÐac kai me ton qr sth all kai me thn alusÐda ekpomp c. EpÐshc afoÔ o qr sthc stèlnei diktuak dedomèna ta opoÐa sto epÐpedo metaforc qrhsimopoioÔn to prwtìkollo IP, prèpei h diasÔndesh tou qr sth me ton kìmbo na qrhsimopoieÐ èna prwtìkollo to opoÐo na mporeÐ na metafèrei IP dedomèna. Ta pio katllhla ja mporoÔsan na jewrhjoÔn to
Ethernet
(ensÔrmato asÔrmato) to
PPP.
Apì thn meri tou o kìmboc gia na epikoinwn sei me thn alusÐda ekpomp c qreizetai na knei qr sh enìc apì ta prwtìkolla pou qrhsimopoioÔn suskeuèc aut c thc klshc gia na antallxoun dedomèna metaxÔ touc. Ta dÔo eurÔtera qrhsimopoioÔmena eÐnai to
ASI
kai to
apaÐthsh o kìmboc na diajètei èna tètoio
interface.
SDI.
'Etsi prokÔptei h
Tèloc, gia na mporèsei na gÐnei katanohtì autì pou stèlnei o kìmboc sthn 43
Keflaio 5. Sqediasmìc
44
platfìrma prèpei na metatrapeÐ apì
IP
wn. 'Etsi o kìmboc pou ja ulopoihjeÐ apokaleÐtai
ULE Encapsulator
pakèta se
MPEG
surmoÔc dedomèn-
o opoÐoc apì t¸ra kai sto ex c ja
ja èqei kai thn upoqrèwsh thc metatrop c
aut c h opoÐa pragmatopoieÐtai me thn mèjodo thc
ULE
enjulkwshc.
'Eqontac aut kat nou eÐmaste se jèsh na prosdiorÐsoume me akrÐbeia tic apait seic pou èqei o kìmboc pou qreiazìmaste apì pleurc ulikoÔ.
5.2
Sqediasmìc diktÔou
Sto dÐktuo pou prèpei na ulopoihjeÐ, kentrikì rìlo èqei o ULE enjulakwt c. Autìc eÐnai o sundetikìc krÐkoc anmesa sthn alusÐda ekpomp c
DVB-T
kai
ston qr sth. O qr sthc prèpei, me kpoion trìpo, na allhlepidr me ton enjulakwt , ¸ste na mporeÐ na tou metafèrei ta dedomèna pou prèpei na diasqÐsoun to dÐktuo thc yhfiak c thleìrashc. H diasÔndesh aut mporeÐ na gÐnei me èna diktuakì
interface.
AfoÔ, t¸ra, o enjulakwt c lbei ta diktuak dedomèna kai ta metatrèyei se MPEG2-TS prèpei na ta metafèrei sthn alusÐda ekpomp c, mèsw enìc ASI interface,
¸ste na diamorfwjoÔn kai na ekpemfjoÔn.
Apì thn meri tou qr sth o opoÐoc lambnei thn ro tou prèpei na uprqei ènac
DVB-T receiver
DVB,
t¸ra,
¸ste na lbei to s ma. Akìma, to
sÔsthma tou qr sth, prèpei na èqei èna leitourgikì to opoÐo na mporeÐ na apokwdikopoi sei mÐa ro
ULE
mèsa apì èna
MPEG-2 TS
surmì dedomènwn
kai na to metafrsei se diktuak kÐnhsh. Autì apoteleÐ mÐa apl diadikasÐa, an to leitourgikì tou qr sth an kei sthn oikogèneia twn
Linux.
'Ena teleutaÐo b ma pou prèpei na efarmosteÐ, ¸ste na èqoume èna pragmatikì dÐktuo pnw apì to DVB-T, eÐnai na broÔme ènan trìpo, ¸ste dedomèna apì ton deÔtero qr sth, na eÐnai dunatìn na ftsoun ston pr¸to. Autì eÐnai anagkaÐo, dedomènhc thc monìdromhc fÔshc tou
DVB-T
prwtokìllou. Gia
ton skopì thc èreunac aut c thc ergasÐac, h lÔsh se autì to prìblhma eÐnai tetrimmènh kai mporeÐ na exomoiwjeÐ me thn qr sh enìc koinoÔ diktuakoÔ interface.
5.3. SQEDIASM'OS EFARMOG'HS
5.3
45
Sqediasmìc efarmog c
Ta dedomèna proc enjulkwsh apostèlnontan ston enjulakwt mèsw enìc Ethernet interface.
'Etsi h efarmog enjulkwshc ìfeile na ta lbei diab-
zontac ta pakèta pou kateujÔnontan proc to mhqnhma. Akìmh, o enjulakwt c ofeÐlei na teleÐ tautìqrona arketèc diadikasÐec. Prèpei na mporeÐ na lambnei tautìqrona dedomèna apì polloÔc qr stec kai na ta poluplèkei ston Ðdio surmì dedomènwn. Akìmh eÐnai upoqrewtikì, an takt qronik diast mata, na dhmiourgeÐ kai na enswmat¸nei pakèta elègqou ston surmì dedomènwn. 'Allh mÐa upoqrèwsh eÐnai na mporeÐ na allhlepidrsei me to ASI interface, pou uprqei sto mhqnhma, ¸ste na eÐnai dunat h apostol tou surmoÔ pou dhmiourgeÐtai mèsw autoÔ. EpÐshc, mia polÔ shmantik apaÐthsh eÐnai h upost rixh twn padding
packing
kai
teqnik¸n gia thn enjulkwsh.
'Ola ta dedomèna pou lambnontai kai ekpèmpontai apì ton enjulakwt , prèpei na apojhkeÔontai proswrin sthn mn mh me thn bo jeia kpoiou eÐdouc dom c dedomènwn. Autì eÐnai aparaÐthto gia na eÐnai dunat h apostol tou swstoÔ arijmoÔ
null packets
¸ste na paramènei stajerì to
gia na eÐnai efikt h mèjodoc enjulkwshc
packing.
bit rate
ìpwc kai
46
Keflaio 5. Sqediasmìc
Keflaio 6
UlopoÐhsh
6.1
UlopoÐhsh kìmbou
O upologist c pou qrhsimopoi jhke gia ton rìlo tou ULE Encapsulator tan ènac
Pentium III
me 512
krta diktÔou kai mia
MBytes SD RAM,
DVB Master III Tx
efodiasmènoc me mia
krtac me
ASI interface
Ethernet
¸ste na
eÐnai dunat h epikoinwnÐa me thn alusÐda ekpomp c. To leitourgikì pou ètreqe o
ULE Encapsulator
tan to
Ubuntu Linux
sthn èkdosh Dapper Drake qwrÐc na qreiasteÐ kamÐa idiaÐterh parametropoÐhsh. To mìno anagkaÐo tan h egkatstash twn odhg¸n thc krtac III Tx,
DVB Master
oi opoÐoi parèqontai apì thn kataskeustria etairÐa.
Prin mporèsei, bèbaia, kaneÐc na steÐlei kti apì thn krta DVB Master III Tx,
prèpei na gÐnoun oi aparaÐthtec rujmÐseic. Oi shmantikìterec rujmÐseic
eÐnai o prosdiorismìc tou megèjouc kai tou pl jouc twn
buers,
oi opoÐoi
ja qrhsimopoihjoÔn apì thn krta. Oi metabol twn tim¸n aut¸n epidr sthn epÐdosh tou sust matoc. 'Etsi gia na uprxei bèltisth epÐdosh prèpei na brejoÔn oi bèltistec timèc. 'Epeita apì merikèc peiramatikèc metr seic prosdiorÐsthke to pl joc kai to mègejoc twn antÐstoiqa.
47
buers
na eÐnai 6 kai 1182
Keflaio 6. UlopoÐhsh
48
Sq ma 6.1: H eÐsodoc diktÔou kai h
6.2
ASI
èxodoc tou
ULE
enjulakwt .
UlopoÐhsh diktÔou
Prokeimènou na gÐnoun metr seic kai na axiologhjeÐ h apìdosh tou capsulator
ULE En-
sqedisthke kai ulopoi jhke èna prìtupo dÐktuo. Autì apoteloÔn-
tan apì dÔo qr stec, ton ULE enjulakwt kai thn alusÐda ekpomp c yhfiak c thleìrashc. O upologist c pou anèlabe ton rìlo twn qrhst¸n, kai apì t¸ra ja anafèretai wc
client,
tan ènac
tourgikì pou ètreqe tan
Pentium
Debian testing.
4/
3GHz
me 1GB
me
me to diktuakì
IP
To lei-
Gia na eÐnai dunat h apostol
dedomènwn ston enjulakwt , qrhsimopoi jhke èna diktuakì client (eth0)
RAM.
interface
dieÔjunsh 172.16.0.1. Autì sundèjhke sto Ðdio
interface
tou enjulakwt (eth0) to opoÐo eÐqe
IP
ston
switch
dieÔjunsh
172.16.0.236. Akìmh gia na prowjhjeÐ h kÐnhsh apì ton enjulakwt se èna llo
interface
tou
client,
bo jeia tou ergaleÐou
up rqe mia krta l yhc
dvbnet
tan se èna prokajorismèno
h enjulakwmènh
PID,
DVB-T
IP
s matoc. Me thn
plhroforÐa, pou briskì-
apoqwrÐsthke apì ton lambanìmeno surmì
dedomènwn kai prowj jhke se èna ideatì diktuakì
interface,
to
dvb0
0. Me
autìn ton trìpo epiteÔqjhke h pro¸jhs twn dedomènwn se èna llo interface mèsw miac diergasÐac difanhc proc ton qr sth kai to leitourgikì.
6.2. ULOPO'IHSH DIKT'UOU
Sq ma 6.2: H krta
49
DVB Master III Tx.
Gia na ftsoun ìmwc ta dedomèna apì ton enjulakwt sthn krta l yhc tou
client,
prèpei na metatrèyei ta dedomèna pou èlabe apì ton
interface eth0
se ènan surmì dedomènwn me thn mèjodo thc
client
ULE
apì to
enjulkw-
shc. Autì eÐnai anagkaÐo ¸ste na eÐnai efikt h pro¸jhs tou sthn alusÐda ekpomp c h opoÐa perigrfetai analutikìtera paraktw. AfoÔ ta dedomèna ftsoun sthn alusÐda ekpomp c, aut analambnei na diamorf¸sei ton surmì dedomènwn ¸ste na paraqjeÐ to
DVB-T
s ma proc ekpomp .
'Epeita to diamorfwmèno s ma prowjeÐtai sthn keraÐa gia thn ekpomp tou sthn mpnta twn
UHF.
Met apì autì to stdio opoiosd pote qr sthc, o
opoÐoc brÐsketai entìc thc perioq c kluyhc, mporeÐ na èqei prìsbash sta dedomèna, arkeÐ fusik na diajètei èna sÔsthma l yhc s matoc epÐgeiac yhfiak c thleìrashc, èna sÔsthma apoenjulkwshc twn
ULE
dedomènwn se
pakèta. Aut ta apaitoÔmena qarakthristik eÐnai uparkt ston
client
IP
ìpwc,
èqoume anafèrei, ra o client eÐnai se jèsh na lbei ta ekpempìmena dedomèna. SÔmfwna me ta parapnw eÐnai dunatìn me ton diajèsimo exoplismì na kataskeuasteÐ to dÐktuo thc eikìnac 6.3. H idèa gia thn ulopoÐhsh aut c thc arqitektonik c sunoyÐzetai sta ex c: o
client
stèlnei ston enjulakwt mèsw tou
interface eth0
ta diktuak
Keflaio 6. UlopoÐhsh
50
Sq ma 6.3: H arqitektonik tou diktÔou pou qrhsimopoi jhke gia tic metr seic. pakèta (me lla lìgia, thn plhroforÐa pou epijumeÐ na ekpèmyei). o enjulakwt c sullègei aut ta dedomèna, ta enjulak¸nei se ènan MPEG2-TS
surmì dedomènwn kai ta prowjeÐ, mèsw tou
ASI interface
pou diajètei sthn platfìrma ekpomp c yhfiak c thleìrashc. o surmìc dedomènwn ftnei ston diamorfwt ìpou kai metatrèpetai se s ma
DVB-T.
ekpèmpetai sta o
client,
To s ma, afoÔ enisqujeÐ, prowjeÐtai sthn keraÐa kai UHF.
èqontac sthn dijes mÐa koin krta l yhc
DVB-T,
lambnei
to s ma kai, mèsw eidikoÔ software1 , dhmiourgeÐtai èna eikonikì diktuakì interface (dvb0_0)
ìpou kai anadhmiourgoÔntai ta diktuak pakèta pou
eÐqan arqik ekpemfjeÐ. 1η
διαδικασία περιγράφεται στο κεφάλαιο 8.1.3.
6.2. ULOPO'IHSH DIKT'UOU
6.2.1
51
AlusÐda ekpomp c
Apì thn alusÐda ekpomp c yhfiak c thleìrashc pou diajètei to ergast rio 'Ereunac kai Anptuxhc Thlepikoinwniak¸n Susthmtwn PASIFAH, qrhsimopoi jhke ènac
DVB-T modulator
kai ènac enisqut c. 'Etsi ègine dunat h
ekpomp s matoc yhfiak c thleìrashc to opoÐo perieÐqe ta èlabe san eÐsodo o
dedomèna poÔ
DVB-T modulator.
Sq ma 6.4: O
O diamorfwt c
IP
DVB-T
DVB-T (COFDM)
diamorfwt c.
rujmÐsthke se diamìrfwsh 16QAM,
rujmì k¸dika 7/8 kai disthma fÔlaxhc
(guard interval)
Ðso me to 1/32 tou
m kouc sumbìlou. Oi parmetroi autèc antistoiqoÔn se wfèlimo rujmì dedomènwn Ðso me 21.11Mbps. EpÐshc wc fèronta s mata dhl¸nontai 8K . H suqnìthta tou s matoc ekpomp c eÐnai sta 538MHz (kanli 29) me epÐpedo dÔnamhc
(power level) 0dBm
kai to sugkekrimèno kanli èqei eÔroc 8MHz.
52
Keflaio 6. UlopoÐhsh
6.3
UlopoÐhsh efarmog c
6.3.1 Buers 'Ena polÔ shmantikì mèroc thc efarmog c, eÐnai h dhmiourgÐa
buers
ìpou
ja gÐnetai h proswrin apoj keush twn pakètwn ¸ste na eÐnai dunat h asÔgqronh epexergasÐa touc. Autì eÐnai aparaÐthto ¸ste h efarmog na mporeÐ na leitourg sei swst kai na epiteuqjeÐ h mègisth dunat apìdosh. Sthn ousÐa oi
buers
pou ulopoi jhkan eÐnai kuklikèc ourèc. Prin qrhsi-
mopoihjoÔn arqikopoioÔntai èqontac wc orÐsmata to mègisto mègejoc dedomènwn gia kje jèsh kai to mègisto pl joc jèsewn pou mporeÐ na uposthrÐxei o buer.
6.3.2
EpikoinwnÐa me thn krta
Prokeimènou na prowjhjoÔn ta pakèta sthn krta to prìgramma qrhsimopoieÐ k¸dika o opoÐoc parèqetai me touc odhgoÔc thc krtac kai frontÐzoun gia thn arqikopoÐhsh thc. 6.3.2.1
ArqikopoÐhsh
Gia thn arqikopoÐhsh thc krtac tropopoi jhke to arqeÐo
txtest.c
¸ste antÐ
na stèlnei thn kÐnhsh pou lambnei san eÐsodo, apl na arqikopoieÐ thn krta me ta orÐsmata pou parèqontai kat thn kl sh thc efarmog c. Ta orÐsmata aut eÐnai h krta h opoÐa ja qrhsimopoihjeÐ (sun jwc rujmÐseic gia na epiteuqjeÐ to epijumhtì 6.3.2.2
/dev/asitx0)
kai
bit rate.
Apostol dedomènwn
H apostol enìc
TS
pakètou gÐnetai apì thn sunrthsh
faÐnetai paraktw. // tp_send sends the transport packet to output void send_tp ( unsigned char * tp ) { fd_set writeset ; int result , bytes ; do { FD_ZERO (& writeset ); FD_SET (fd , & writeset ); result = select ( fd + 1, NULL , & writeset , NULL , NULL ); } while ( result == -1 );
send_tp
h opoÐa
6.3. ULOPO'IHSH EFARMOG'HS
53
if ( result > 0) { if ( FD_ISSET (fd , & writeset )) { if ( ( bytes = write (fd , tp , 188) ) < 0) { printf (" \ nError writing .\ n") ; } else { // printf (" wrote % d bytes \n ", bytes ); } } } return ; }
Met thn arqikopoÐhsh thc krtac, h opoÐa emfanÐzetai san arqeÐo sto leitourgikì, mporeÐ plèon na prospelasteÐ parìmoia me èna koinì arqeÐo. 'Etsi eÐnai dunatìn na metaferjoÔn dedomèna sthn krta knontac qr sh klasik¸n sunart sewn diaqeÐrishc arqeÐwn thc
6.3.3
Sullog
IP
C.
pakètwn
Basikì mèroc thc leitourgÐac tou enjulakwt eÐnai h ankthsh twn IP pakètwn apì to dÐktuo ¸ste aut na upostoÔn thn diadikasÐa thc enjulkwshc. 'Ena autìnomo thread analambnei aut n thn diergasÐa h opoÐa analÔetai paraktw. 6.3.3.1
Biblioj kh
libpcap
Gia thn ankthsh pakètwn apì èna dÐktuo uprqei èna API to opoÐo anafèretai wc
pcap.
libpcap
kai
H ulopoÐhsh autoÔ tou
API
gia
Unix
sust mata eÐnai gnwst wc
kai eÐnai sqediasmènh gia qr sh apì tic gl¸ssec programmatismoÔ
C++.
'Etsi knontac qr sh tou
libpcap
C
h efarmog pou anaptÔqjhke
eÐnai se jèsh na sullèxei apì to dÐktuo ta proc enjulkwsh
IP
pakèta.
Gia na apofeuqjeÐ h sÔgqush me lla pakèta tou diktÔou, h sullog twn pakètwn periorÐsthke me thn qr sh enìc fÐltrou. To fÐltro autì epètrepe thn sullog mìno
IP
pakètwn apì èna sugkekrimèno apostolèa.
6.3.3.2 IP buer Kaj¸c, gia kalÔtera apotelèsmata kai gia na eÐnai dunat h mèjodoc enjulkwshc
packing,
ta
IP
pakèta pou sullègontai qrhsimopoioÔntai an
sugkekrimèna qronik diast mata, prèpei kpou na gÐnetai h proswrin apoj keush twn pakètwn. Gi' autìn ton skopì kataskeusthkan oi perigrfontai sto keflaio 6.3.1.
buers
pou
Keflaio 6. UlopoÐhsh
54
H arqikopoÐhsh tou buer gÐnetai me thn paraktw entol . Oi timèc shmaÐnoun ìti to mègisto mègejoc pakètou eÐnai 1540 kai uprqei dunatìthta gia apoj keush wc kai qilÐwn pakètwn. Dedomènou ìti o buer autìc apojhkeÔei ta pakèta pou ftnoun se disthma 5ms oi timèc autèc èqoun upologisteÐ ¸ste na dÐnoun arketì q¸ro gia to eÔroc thc kÐnhshc tou diktÔou. i n i t _ b u f f e r (& ip_buff , 1 0 0 0 , 1 5 6 0 ) ;
6.3.3.3
To
thread
sullog c pakètwn
'Opwc proanafèrjhke, h sullog pakètwn gÐnetai se èna autìnomo upoqrèwsh autoÔ tou pro¸jhs touc ston
thread
thread.
H
eÐnai h sullog twn epijumht¸n pakètwn kai h
IP buer.
'Etsi ta pakèta pou sullègontai paramènoun
sthn mn mh mèqri na èrjei h ¸ra na qrhsimopoihjoÔn.
6.3.4
Enjulkwsh
H enjulkwsh eÐnai h kÔria leitourgÐa tou sust matoc pou anaptÔqjhke. Sthn ousÐa eÐnai h diadikasÐa thc metatrop c TS
IP
pakètwn se pakèta
MPEG-
¸ste na eÐnai dunat h pro¸jhs touc mèsw thc yhfiak c thleìrashc.
6.3.4.1
Algìrijmoc enjulkwshc
Ed¸ parousizetai o algìrijmoc thc diadikasÐac thc enjulkwshc. Enjulkwsh
wc èna
TS
SNDU
An o enjulakwt c den èqei steÐlei prohgoumèn-
pakèto se èna sugkekrimèno prìgramma met apì èna dishme
adrneiac, arqÐzei na stèlnei èna
SNDU
sto pr¸to diajèsimo
TS
pakèto.
Autì to pr¸to pakèto PREPEI na fèrei thn tim 1 sto pedÐo PUSI. PREPEI epÐshc na fèrei tim 0 sto pedÐo
Payload Pointer,
arqÐzei amèswc met ton
Payload Pointer.
SNDU
¸ste na eÐnai fanerì ìti to
O enjulakwt c PREPEI na exasfalÐsei ìti o
Continuity Counter
pou
uprqei sthn kefalÐda tou TS pakètou èqei kajoristeÐ sÔmfwna me to prìtupo ISO-MPEG2.
Aut h tim prèpei na auxnetai kat èna (modulo 16) gia kje
epakìloujo pakèto pou perièqei èna mèroc olìklhro to SNDU pou stèlnetai se èna prìgramma.
6.3. ULOPO'IHSH EFARMOG'HS
55
O enjulakwt c MPOREI na apofasÐsei na mhn steÐlei llo SNDU amèswc, akìmh kai an uprqei diajèsimoc q¸roc se èna mh pl rec h diadikasÐa eÐnai gnwst wc uprqoun lla
SNDU
padding.
se autì to
TS
O
End Indicator
pakèto. O
TS
pakèto. Aut
plhroforeÐ ìti den
End Indicator
akoloujeÐtai
apì mhdèn h perissìtera mh qrhsimopoioÔmena
bytes
pakètou. 'Ola ta mh qrhsimopoioÔmena
PREPEI na proun thn tim
0xFF,
bytes
akolouj¸ntac thn trèqousa praktik tou
padding
mèqri to tèloc tou
MPEG-2.
TS
H diadikasÐa tou
antallssei meiwmènh apodotikìthta me beltiwmènh kajustèrhsh.
Enallaktik, an uprqoun perissìtera pakèta en anamon ston enjulakwt , kai èna pakèto èqei arketì upoleipìmeno q¸ro metaforc, o enjulakwt c mporeÐ na suneqÐsei to prohgoÔmeno mopoi¸ntac to epìmeno diajèsimo apokaleÐtai
byte
sto
SNDU
TS
me èna epìmeno qrhsi-
pakèto. Aut h diadikasÐa
packing.
DiadikasÐa gia
packing
kai
padding
.
Mìlic o enjulakwt c oloklhr¸-
sei thn enjulkwsh enìc SNDU uprqoun pènte diaforetikèc peript¸seic pou mporeÐ na sumboÔn: 1. An to pakèto TS den diajètei llo q¸ro, o enjulakwt c metadÐdei autì to pakèto. 'Epeita xekinei h metdosh enìc nèou
SNDU
se èna nèo
TS
pakèto. 2. An to TS pakèto pou perièqei to teleutaÐo kommti enìc SNDU èqei èna byte
aqrhsimopoÐhtou q¸rou, o enjulakwt c PREPEI na topojet sei
thn tim
0xFF
se autì to teleutaÐo
byte
kai na metad¸sei autì to
TS
pakèto. 3. An to
TS
pakèto pou perièqei to teleutaÐo kommti enìc
akrib¸c dÔo
byte
aqrhsimopoÐhtou q¸rou, kai to pedÐo
SNDU
PUSI
DEN èqei
dh tim 1, o enjulakwt c PREPEI na topojet sei thn tim F
se aut ta teleutaÐa
na metad¸sei autì to
byte,
TS
èqei
0xFFF-
¸ste na orÐsei ènan deÐkth tèlouc, kai
pakèto. 'Epeita o enjulakwt c PREPEI na
xekin sei thn metdosh tou epìmenou
SNDU
se èna nèo
TS
pakèto.
Keflaio 6. UlopoÐhsh
56
4. An to
TS
pakèto èqei pnw apì duo
byte
aqrhsimopoÐhtou q¸rou, o
enjulakwt c MPOREI na metad¸sei autì to mh pl rec TS pakèto all PREPEI pr¸ta na topojet sei thn tim aqrhsimopoÐhta
byte.
0xFF
se ìla ta enapomeÐnanta
'Epeita o enjulakwt c PREPEI na xekin sei thn
metdosh tou epìmenou
SNDU
se èna nèo
TS
pakèto.
5. An toulqiston dÔo byte eÐnai diajèsima (me lla logÐa, trÐa byte an to PUSI
DEN èqei prei tim 1 dh, kai dÔo byte an èqei prei tim 1 dh),
o enjulakwt c MPOREI na enjulak¸sei epiplèon en anamon , me to na arqÐsei to epìmeno byte NDU
tou
TS
se èna
SNDU
PDU
euriskìmena
sto epìmeno diajèsimo
pakètou. 'Otan o enjulakwt c suneqÐzei na paketrei TS
pakèto ìpou to
PUSI
den èqei prei tim 1, to
PREPEI na prei tim 1, kai ènac 8-bit eisaqjeÐ sto pr¸to
byte
An den uprqoun lla perimènei gia epìmena
Payload Pointer
pou akoloujeÐ thn kefalÐda tou
PDU
PDU
S-
PUSI
PREPEI na TS
pakètou.
se anamon , o enjulakwt c MPOREI na
¸ste na gemÐsei to
TS
pakèto. H mègisth
qronik perÐodoc pou mporeÐ na perimènei ènac enjulakwt c, gnwst wc
Packing Threshold,
PREPEI na oriojethjeÐ kai OFEILEI na eÐnai
parametropoi simh apì ton enjulakwt . An DEN lhfjoÔn pakèta mèsa sta ìria tou
Packing Threshold,
o enjulakwt c PREPEI na eisgei è-
nan deÐkth tèlouc. 6.3.4.2
UlopoÐhsh enjulakwt
Sto sq ma 6.5 faÐnetai to digramma ro c thc diadikasÐac thc enjulkwshc qrhsimopoi¸ntac thn mèjodo autìnomo
H enjulkwsh lambnei q¸ra se èna
thread.
Basikìc brìgqoc
bnetai kje 5 tai an o
packing.
buer
ms.
H enjulkwsh gÐnetai se ènan brìgqo o opoÐoc epanalam-
Arqik gia thn eÐsodo ston brìgqo enjulkwshc elègqe-
pou kratei ta sulleqjènta
den qreizetai na gÐnei enjulkwsh
IP
pakèta eÐnai deioc
an apì prin èqei meÐnei èna
opìte
SNDU
pou
den èqei oloklhrwjeÐ h enjulkws tou opìte kai qreizetai na suneqisteÐ h diadikasÐa.
6.3. ULOPO'IHSH EFARMOG'HS
57
'Otan gÐnei h eÐsodoc ston brìgqo, an uprqei diajèsimh arket plhroforÐa, aut prowjeÐtai se èna TS pakèto, alli¸c anakttai to epìmeno SNDU apì ton
IP buer.
Sto epìmeno stdio, an kai ìso uprqoun dedomèna pnw apì 184 proc enjulkwsh ta prowjeÐ se epìmena
TS
pakèta.
'Epeita, an èqei epilegeÐ h mèjodoc enjulkwshc bytes
èqoun apomeÐnei se èna
bytes
(diadikasÐa
packing, buer
stung).
TS
bytes
padding,
grfontai ìsa
pakèto kai to upìloipo gemÐzetai me
null
An h epilegmènh mèjodoc enjulkwshc eÐnai h
tìte, an uprqoun lla diajèsima
SNDU
diabzontai apì ton
IP
mèqri na sumplhrwjeÐ to TS pakèto. An meÐnoun bytes pou den q¸resan
sto pakèto, tìte sthn epìmenh epanlhyh h enjulkwsh xekinei apì aut. An den uprqoun arket diajèsima tìte akoloujeÐ h diadikasÐa tou prowjhjeÐ ston
SNDU
stung,
¸ste na gemÐsei to
TS
pakèto,
¸ste na gemÐsei to pakèto kai na
TS buer.
AfoÔ gÐnei aut h diadikasÐa, gÐnetai pli eÐsodoc ston brìgqo enjulkwshc kai epanalambnetai aut h diadikasÐa, mèqri na adeisei o
IP buer.
Mìlic telei¸sei o brìgqoc enjulkwshc, prèpei na diapistwjeÐ en o buer
TS
eÐnai pl rhc ìpwc ofeÐlei na eÐnai gia na diathrhjeÐ stajerì to bit rate.
An den eÐnai tìte akoloujeÐ ènac brìgqoc o opoÐoc prowjeÐ TS buer
null
pakèta ston
mèqri na gemÐsei.
Tèloc, afoÔ o
TS buer
eÐnai pl rhc, prèpei na prowj soume ta pakèta
sthn krta. Autì gÐnetai se ènan brìgqo ìpou diabzontai èna èna ta pakèta apì ton
TS buer
kai prowjoÔntai sthn krta.
AfoÔ gÐnei kai autì uprqei mia anamon 5 ms kai h ro tou progrmmatoc epistrèfei ston kÔrio brìgqo.
6.3.4.3 Crc checksum Kje pakèto
SNDU
perièqei sta teleutaÐa 4
Bytes
ta opoÐa dhmiourgoÔntai
apì ènan algìrijmo kuklikoÔ elègqou pleonasmoÔ (crc Aut ta
bit
checksum)
32
bit.
qrhsimopoioÔntai gia na pistopoihjeÐ ston dèkth h akeraiìthta
tou dedomenograf matoc pou èlabe. To kleidÐ pou genesiourgì polu¸numo gia ton algìrijmo eÐnai to
0x104C11DB7
kai h arqik tim eÐnai
0xFFFFFFFF.
58
Keflaio 6. UlopoÐhsh
Sq ma 6.5: Digramma ro c gia thn mèjodo tou
packing.
6.3. ULOPO'IHSH EFARMOG'HS
59
6.3.4.4 TS buer Kje pakèto pou
TS
apojhkeÔetai se ènan
pou pargetai kat thn diadikasÐa thc enjulkwshc buer
o opoÐoc èqei arqikopoihjeÐ katllhla gia up-
osthrÐxei thn ro twn pakètwn. 6.3.4.5
Apostol
An takt qronik diast mata gÐnetai h pro¸jhsh twn buer
TS
pakètwn apì ton
thc efarmog c stouc buers thc krtac. To bit rate prèpei na diathreÐ-
tai stajerì kai o
buer
thc efarmog c èqei arqikopoihjeÐ katllhla ¸ste,
an adeizei olìklhroc sta problepìmena qronik diast mata, na dÐnei to epijumhtì bit rate. 'Etsi, prin prowjhjoÔn ta pakèta, èqei problefjeÐ na gemÐzei o
me
buer
null
pakèta kai sunep¸c prowjoÔntai tìsa pakèta ìsa qreizetai
akrib¸c ¸ste na diathrhjeÐ to
bit rate
stajerì.
H apostol twn dedomènwn, t¸ra, gÐnetai me thn sunrthsh
tp_send
pou
perigrfhke sto keflaio 6.3.2.2.
6.3.5
DhmiourgÐa pakètwn elègqou
Prokeimènou na dhmiourghjeÐ ènac ègkuroc surmìc dedomènwn pou ja mporeÐ na anagnwristeÐ prèpei an diast mata na ekpèmpontai pakèta elègqou. Kje pakèto èqei eidik shmasÐa mèsa se ènan MPEG2 surmì dedomènwn. Ta pakèta pou qrhsimopoi jhkan apì thn efarmog perigrfontai paraktw.
6.3.5.1 PAT To
PAT
t¸n
(Program
PMT
Association Table)
perièqei mÐa lÐsta apì ta
pakètwn pou perièqontai ston surmì dedomènwn. Ta
èqoun pnta
PID
PID
tou
ìlwn
PAT
pakèta
PID
48 pou
Ðso me 0.
Sthn efarmog pou anaptÔqjhke to eÐnai to
PID
PMT
PAT
perièqei mìno to
pou perigrfei to monadikì prìgramma mèsa ston sur-
Keflaio 6. UlopoÐhsh
60
mì dedomènwn pou dhmiourgeÐtai. To prìgramma autì eÐnai ta enjulakwmèna dedomèna. Paraktw faÐnetai h morf tou 0000: 0010: 0020: 0030: 0040: 0050: 0060: 0070: 0080: 0090: 00 a0 : 00 b0 :
47 30 ff ff ff ff ff ff ff ff ff ff
40 b1 ff ff ff ff ff ff ff ff ff ff
00 22 ff ff ff ff ff ff ff ff ff ff
12 84 ff ff ff ff ff ff ff ff ff ff
00 db ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff ff
b0 ff ff ff ff ff ff ff ff ff ff ff
09 ff ff ff ff ff ff ff ff ff ff ff
PAT
02 ff ff ff ff ff ff ff ff ff ff ff
22 ff ff ff ff ff ff ff ff ff ff ff
pakètou. c1 ff ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff
05 ff ff ff ff ff ff ff ff ff ff
e0 ff ff ff ff ff ff ff ff ff ff
G@ . . . . . . . " . . . . . . 0."............. ................ ................ ................ ................ ................ ................ ................ ................ ................ ............
6.3.5.2 PMT To
PMT (Program Map Table)
perièqei plhroforÐec gia progrmmata. Gia
kje prìgramma uprqei èna PMT to opoÐo me thn seir tou emfanÐzetai se èna sugkekrimèno
PID.
To
PMT
perigrfei poia
perièqoun dedomèna meta-
PID
dedomèna gia to sugkekrimèno prìgramma. Gia pardeigma gia èna prìgramma to
PMT
ofeÐlei na perièqei to
PID
pou èqei h ro eikìnac, to
PID
pou èqei
h ro tou qou ktl. Sthn efarmog pou anaptÔqjhke to ta
ULE
enjulakwmèna dedomèna; dhlad to
Paraktw faÐnetai h morf tou 0000: 0010: 0020: 0030: 0040: 0050: 0060: 0070: 0080: 0090: 00 a0 : 00 b0 :
PMT
47 30 ff ff ff ff ff ff ff ff ff ff
40 b1 ff ff ff ff ff ff ff ff ff ff
00 22 ff ff ff ff ff ff ff ff ff ff
12 84 ff ff ff ff ff ff ff ff ff ff
00 db ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff ff
b0 ff ff ff ff ff ff ff ff ff ff ff
09 ff ff ff ff ff ff ff ff ff ff ff
PAT
02 ff ff ff ff ff ff ff ff ff ff ff
22 ff ff ff ff ff ff ff ff ff ff ff
deÐqnei to
PID
ìpou uprqoun
PID 0x150.
pakètou. c1 ff ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff
00 ff ff ff ff ff ff ff ff ff ff
05 ff ff ff ff ff ff ff ff ff ff
e0 ff ff ff ff ff ff ff ff ff ff
G@ . . . . . . . " . . . . . . 0."............. ................ ................ ................ ................ ................ ................ ................ ................ ................ ............
6.3. ULOPO'IHSH EFARMOG'HS 6.3.5.3
SDT
To SDT (Service
Description Table)
progrmmatoc kai ton paroqèa. To Paraktw faÐnetai h morf tou 0000: 0010: 0020: 0030: 0040: 0050: 0060: 0070: 0080: 0090: 00 a0 : 00 b0 :
47 00 44 ff ff ff ff ff ff ff ff ff
6.3.5.4
61
40 05 56 ff ff ff ff ff ff ff ff ff
11 fc 42 ff ff ff ff ff ff ff ff ff
17 80 20 ff ff ff ff ff ff ff ff ff
00 15 68 ff ff ff ff ff ff ff ff ff
42 48 61 ff ff ff ff ff ff ff ff ff
b0 13 63 ff ff ff ff ff ff ff ff ff
26 0c 6b ff ff ff ff ff ff ff ff ff
02 06 65 ff ff ff ff ff ff ff ff ff
perièqei plhroforÐec ìpwc to ìnoma tou
PID
tou eÐnai pnta 17.
SDT
pakètou.
22 6e 72 ff ff ff ff ff ff ff ff ff
00 76 27 ff ff ff ff ff ff ff ff ff
c1 6b 09 ff ff ff ff ff ff ff ff ff
00 6f 80 ff ff ff ff ff ff ff ff
12 72 e2 ff ff ff ff ff ff ff ff
34 6e ff ff ff ff ff ff ff ff ff
ff 0a ff ff ff ff ff ff ff ff ff
G@ . . . B . & . " . . . . 4 . . . . . . H . . . nkvorn . DVB h a c k e r . ' . . . . ................ ................ ................ ................ ................ ................ ................ ................ ............
Apostol
Ta pakèta aut ofeÐloun na ekpèmpontai mèsw tou MPEG2 surmoÔ dedomènwn to polÔ kje 100ms ¸ste na gÐnetai h swst anagn¸ris tou. Gi' autìn ton skopì uprqei ènac brìgqoc o opoÐoc analambnei aut thn upoqrèwsh. Mèroc thc ulopoÐhshc tou brìgqou apì to tm ma thc apostol c paratÐjetai. ...
...
patPacket [3] = 0 x10 | counter ; pmtPacket [3] = 0 x10 | counter ; sdtPacket [3] = 0 x10 | counter ; pthread_mutex_lock (& mutexfd ) ; send_tp ( patPacket ); send_tp ( pmtPacket ); send_tp ( sdtPacket ); pthread_mutex_unlock (& mutexfd ); usleep (100000) ; counter = ++ counter % 16;
62
Keflaio 6. UlopoÐhsh
Keflaio 7
'Elegqoc
7.1
ErgaleÐa metr sewn
Gia thn pragmatopoÐhsh metr sewn, ¸ste na gÐnei dunat h axiolìghsh tou diktÔou, qreisthkan orismèna progrmmata ta opoÐa mporoÔn na d¸soun thn dunatìthta na dhmiourghjeÐ kÐnhsh sto dÐktuo, na metrhjeÐ kai na analujeÐ. Ta progrmmata pou qrhsimopoi jhkan ja perigrafoÔn paraktw.
7.1.1 tcpdump To
tcpdump
eÐnai èna prìgramma gramm c entol¸n to opoÐo epitrèpei thn
anÐqneush kai katagraf pakètwn pou ekpèmpontai lambnontai se mia krta diktÔou. EÐnai idiaÐtera qr simo gia tic metr seic pou ofeÐloun na gÐnoun, kaj¸c dÐnei thn dunatìthta na sullhfjoÔn ìla ta pakèta sugkekrimèna pakèta, bsei periorism¸n, pou kinoÔntai se èna dÐktuo kai na apojhkeutoÔn se èna arqeÐo. Ta arqeÐa aut, pou dhmiourgoÔntai gia kje mètrhsh, qrhsimopoioÔntai sthn metèpeita anlush.
7.1.2 mgen To mgen eÐnai èna prìgramma anoiktoÔ logismikoÔ to opoÐo parèqei thn dunatìthta na pragmatopoihjoÔn test diktuak c apìdoshc kai metr seic qrhsimopoi¸ntac
UDP/IP
kÐnhsh. 63
64
Keflaio 7. 'Elegqoc Autì to ergaleÐo dhmiourgeÐ morf¸mata kÐnhshc pragmatikoÔ qrìnou, oÔtwc
¸ste na mporeÐ to dÐktuo na fortwjeÐ me kÐnhsh me mÐa poikilÐa sunduasm¸n. QrhsimopoieÐ
script
arqeÐa ¸ste na eÐnai dunat h qronik katanom twn mor-
fwmtwn kÐnhshc. Autì to ergaleÐo eÐnai sqediasmèno gia sust mata
unix
all kai
windows
sust mata.
7.1.3 dvbnet To dvbnet eÐnai èna ergaleÐo pou perièqetai sto uposÔsthma odhg¸n gia DVB suskeuèc tou pur na tou
Linux.
kai sunthreÐtai apì to prìtzekt
Autì to uposÔsthma odhg¸n anaptÔssetai Linux TV.
Autì to ergaleÐo eÐnai se jèsh na dhmiourg sei èna eikonikì diktÔou to opoÐo antistoiqÐzetai se èna sugkekrimèno
PID
interface
mÐac ro c dedomèn-
wn. Aut h ro uprqei se èna kanli yhfiak c thleìrashc sto opoÐo pr¸ta prèpei na èqei suntonisteÐ qrhsimopoi¸ntac mia krta l yhc s matoc yhfiak c thleìrashc. AfoÔ gÐnei autì, an entopisteÐ èna enjulakwmèno pakèto sthn ro dedomènwn, to
dvbnet
analambnei na to apoenjulak¸sei kai na to prowj sei
sto eikonikì diktuakì
interface
pou èqei kataskeusei. Aut h diadikasÐa
eÐnai difanh sto leitourgikì sÔsthma, me apotèlesma ta dedomèna pou dromologoÔntai mèsw twn
UHF
na ftnoun amèswc ston telikì qr sth me thn
morf diktuak c kÐnhshc. 'Ena meglo atoÔ tou
dvbnet
eÐnai to gegonìc ìti uposthrÐzei ed¸ kai
kairì tic dÔo basikèc morfèc enjulkwshc, thn
MPE
kai thn
ULE.
H qr sh
tou eÐnai aparaÐthth gia thn ulopoÐhsh tou diktÔou kaj¸c perijwriopoieÐ to prìblhma thc apì-enjulkwshc.
7.1.4 scripts Gia thn anlush twn dedomènwn pou par gagan oi metr seic qrhsimopoi jhkan merik
scripts
se gl¸ssa programmatismoÔ
Perl
kai
Unix shell script.
Aut
tan se jèsh, dÐnontc touc san eÐsodo èna arqeÐo me ta pakèta pou stljhkan
7.2. SEN'ARIA METR'HSEWN
65
kai èna arqeÐo me ta pakèta pou l fjhkan, na upologÐsoun thn kajustèrhsh, thn metabol thc kajustèrhshc kai tic ap¸leiec tou diktÔou.
7.1.5 gnuplot To gnuplot eÐnai èna logismikì anoiqtoÔ k¸dika katllhlo gia thn dhmiourgÐa grafhmtwn apì arqeÐa dedomènwn ìpwc ta arqeÐa pou proèkuyan apì thn anlush twn metr sewn.
7.2
Senria metr sewn
Gia na metrhjeÐ h apìdosh tou diktÔou stljhkan roèc ton
client
ston
ULE
enjulakwt . To
UDP
UDP
dedomènwn apì
prwtìkollo tan h profan c epi-
log afoÔ to dÐktuo pou st jhke gia thn axiolìghsh tou sust matoc eÐnai apì thn fÔsh tou monìdromo. Oi roèc pou stljhkan me to mgen tan dirkeiac 30 deuterolèptwn kai eÔrouc 1500 Kbps. To mègejoc tou pakètou kai h mèjodoc enjulkwshc (packing
padding)
tan oi exarthmènec metablhtèc se kje
mètrhsh.
7.3 7.3.1
PragmatopoÐhsh metr sewn ParametropoÐhsh enjulakwt
Prokeimènou na apod¸sei ta bèltista to prìgramma pou ulopoi jhke eÐnai aparaÐthth h parametropoÐhsh thc DVB krtac. Autì, sthn ousÐa, shmaÐnei ìti qreizetai na dojoÔn oi katllhlec timèc arijmoÔ kai megèjouc twn
buers
thc krtac. Gia na anebrejoÔn oi pio katllhlec timèc, oi timèc dhlad me tic opoÐec to sÔsthma sumperifèretai me ton kalÔtero trìpo, qreisthke na pragmatopoihjoÔn metr seic, stic opoÐec metaballìtan o arijmìc kai to mègejoc twn
buers.
To dÐktuo pou st jhke gia thn diexagwg twn peiramatik¸n metr sewn aut¸n faÐnetai sthn eikìna 6.3. EÐnai mia apl arqitektonik kaj¸c apoteleÐtai apì:
Keflaio 7. 'Elegqoc
66
ènan qr sth o opoÐoc stèlnei dedomèna me thn morf pakètwn ston ton
ULE
ULE
ethernet
enjulakwt
enjulakwt , o opoÐoc lambnei ta dedomèna, ta enjulak¸nei
se ènan surmì dedomènwn kai ta prowjeÐ, mèsw thc diajètei, sthn
DVB-T
ASI
krtac pou
alusÐda ekpomp c.
Thn DVB-T alusÐda ekpomp c, h opoÐa lambnontac ton surmì dedomènwn analambnei gia thn ekpomp tou.1 'Enan deÔtero qr sth, o opoÐoc diajètei mÐa krta l yhc
DVB-T
kai
mèsw katllhlou logismikoÔ ta metatrèpei xan se diktuak kÐnhsh upì thn morf
IP
pakètwn.
Gia thn mètrhsh qrhsimopoi jhke mÐa dhmiourg jhke me to progrmmata
UDP
ro dedomènwn 1,5
Mbps
h opoÐa
mgen.
Gia thn exagwg apotelesmtwn eÐnai aparaÐthto na anakt soume, me kpoion trìpo, ìla ta pakèta pou metafèrjhkan sto dÐktuo kat thn dirkeia thc mètrhshc. Autì epitugqnetai me thn qr sh tou ergaleÐou
tcpdump
to opoÐo
qrhsimopoieÐtai gia na pisei pakèta ta opoÐa ftnoun se èna diktuakì terface.
in-
Qrhsimopoi jhke me ta katllhla orÐsmata gia na apojhkeutoÔn ta
pakèta se èna arqeÐo to opoÐo met qrhsimopoi jhke gia thn anlush. DÔo tètoia arqeÐa eÐnai aparaÐthta gia thn anlush& èna me pakèta pou estlhsan apì ton qr sth 1 mèsw tou diktuakoÔ
interface
kai èna me ta pakèta pou
l fjhkan apì ton qr sth 2 2 . 'Eqontac aut ta arqeÐa kai me ta katllhla scripts
ex qjhsan ta apotelèsmata 3 .
Gia kje zeÔgoc metablht¸n paragìtan 4 apotelèsmata proc sÔgkrish& h tim gia thn kajustèrhsh, gia thn metabol thc kajustèrhshc, thn exomalumènh metabol thc kajustèrhshc kai ta pakèta pou qjhkan se kje mètrhsh. Ta apotelèsmata parousizontai sthn eikìna 7.1. EÐnai fanerì ìti to sÔsthma èqei kalÔterh sumperifor, ìson afor ta qamèna pakèta kai thn 1 λεπτομέρειες
για την σύσταση της πλατφόρμας στο κεφάλαιο 6.2.1 εξηγείται στο κεφάλαιο 6.2, στην πραγματικότητα οι χρήστες 1 και 2, είναι το ίδιο μηχάνημα αλλά η εκπομπή και η λήψη γίνονται από διαφορετικά interface. 3 τα scripts που χρησιμοποιήθηκαν υπάρχουν στο παράρτημα Β.2 και η διαδικασία αναλύεται στο κεφάλαιο 7.3.2. 2 ΄Οπως
7.3. PRAGMATOPO'IHSH METR'HSEWN
67
kajustèrhsh, ìso to mègejoc kai o arijmìc twn
mei¸nontai. EpÐshc
buers
faÐnetai ìti, gia tic metr seic pou pragmatopoi jhkan, oi timèc thc metabol c thc kajustèrhshc den ephrezontai shmantik.
"delay2"
"losses2"
Average One Way Delay (ms)
Average Losses (#) 350
1200
300 350
800
200
300
1000
1200
250
1000
600
800
400
150
250
100 200
200
50
600
0
150
0 400
100
200
50
20000
0
20000 0
15000 5
10000
10 Buffers (number)
15
15000 5
Size of buffers (Bytes)
10000
10
5000
Buffers (number)
20
(αʹ) Η μεταβολή της καθυστέρησης.
15
Size of buffers (Bytes)
5000 20
(βʹ) Οι απώλειες.
"jitter2"
"smothh_jitter2"
Average Jitter (ms)
Average Smoothed Jitter (ms) 10
10
9 10
9 10
8
9
3
2
2 20000
0 10000
10 Buffers (number)
15
20000
1 0
15000 5
3
4
3 1
4
5
3
4
5
6
4
5
6
7
5
6
7
8
6
7
8
9
7
8
15000 5
Size of buffers (Bytes)
5000
Buffers (number)
20
(γʹ) Η μεταβολή της καθυστέρησης.
10000
10 15
Size of buffers (Bytes)
5000 20
(δʹ) Η εξομαλυμένη θυστέρησης.
μεταβολή
της
κα-
Sq ma 7.1: Ta apotelèsmata twn metr sewn gia thn eÔresh tou bèltistou buer. 'Eqontac aut kat nou apofasÐsthke ìti to katallhlìtero zeÔgoc tim¸n gia touc
buers
thc krtac eÐnai 2
buers
me mègejoc 1880
ton sunduasmì tim¸n h kajustèrhsh brÐsketai sta 27,58
ms,
Bytes.
Gi' autìn
ta qamèna pakè-
ta periorÐzontai sto 0,16% kai oi timèc gia th metabol thc kajustèrhshc brÐskontai kont sta 5 zontai sto sq ma 7.2.
ms.
Oi grafikèc gi autèc tic metablhtèc parousi-
Keflaio 7. 'Elegqoc
68
30
3
28 2 26
2 Lost Packets
One Way Delay (ms)
24
22
20
18
2
1
16 0 14
12 0
5
10
15 Time (sec)
20
25
0 00:00
30
14
00:02
00:04
00:06 time (sec)
00:08
00:10
00:12
5
10
15 Time (sec)
20
25
30
6
12
5
10 Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
4 8
6
3
2 4
1
2
0
0 0
5
10
15 Time (sec)
20
25
30
0
Sq ma 7.2: Oi grafikèc parastseic thc kajustèrhshc, twn apwlei¸n, thc metabol c thc kajustèrhshc kai thc exomalumènhc metabol c thc kajustèrhshc sunart sei tou qrìnou.
7.3.2
PragmatopoÐhsh metr sewn axiolìghshc diktÔou
Apì to eth1 interface tou client stljhke kÐnhsh UDP eÔrouc z¸nhc 1.5 Mbps me qr sh tou ergaleÐou mgen. 'Eginan dÔo set metr sewn& èna qrhsimopoi¸ntac thn mèjodo enjulkwshc packing.
1425
padding
kai èna qrhsimopoi¸ntac thn mèjodo
Gia kje mÐa mèjodo metaballìtan to mègejoc pakètou apì 75 mèqri
bytes.
H l yh thc kÐnhshc aut c ègine epÐshc apì ton terface,
to
dvb0
client,
all se llo
in-
0. Prokeimènou na gÐnei h anlush kai o upologismìc ka-
justèrhshc, apwlei¸n k.a. qreisthke na piastoÔn ìla ta pakèta pou ekpèm-
7.3. PRAGMATOPO'IHSH METR'HSEWN fjhkan kai l fjhkan. Autì ègine me qr sh tou ergaleÐou
69
tcpdump
me tic
entolèc pou paratÐjentai paraktw. % su
−
# tcpdump # tcpdump
−vv −w −vv −w
tx
eth0
udp
rx
dvb0_0 udp
−n 9 0 0 0 −n
7500
'Epeita energopoi jhke to mgen kai me to tèloc thc mètrhshc dhmiourg jhkan ta arqeÐa rx kai tx pou perieÐqan ta pakèta pou metadìjhkan kai l fjhkan. Aut ta dÔo arqeÐa dhmiourg jhkan gia kje mètrhsh kai kal¸ntac gia kje zeÔgoc to bash script ipv4_udp, to opoÐo paratÐjetai sto parrthma Bþ.2.1.1, ex qjhsan ta apotelèsmata thc anlushc. Ta apotèlesma twn metr sewn parousizontai sto keflaio 9.1, kai analutik ta diagrmmata gia kje mètrhsh uprqoun sto parrthma Aþ.
70
Keflaio 7. 'Elegqoc
Keflaio 8
LeitourgÐa
8.1 8.1.1
Egkatstash Egkatstash odhg¸n krtac
H egkatstash twn odhg¸n thc krtac eÐnai mia apl diadikasÐa. Ston katlogo pou uprqoun oi phgaÐoi k¸dikec twn odhg¸n prèpei na ektelestoÔn oi akìloujec entolèc: $
make
# make
install
# . / mkdev . a s i
O skopìc aut¸n twn entol¸n eÐnai h metagl¸ttish tou phgaÐou k¸dika se gl¸ssa mhqan c, h egkatstash twn odhg¸n kai tèloc h dhmiourgÐa twn device nodes
1
sta opoÐa eÐnai antistoiqismènh kje krta pou uprqei sto
sÔsthma. AfoÔ, t¸ra, èqoun egkatastajeÐ oi odhgoÐ thc krtac, mporoÔn na fortwjoÔn sto sÔsthma me thn entol : # modprobe dvbm
1 Στα Unix
συστήματα, κάθε συσκευή υλικού αντιστοιχίζεται σε ένα ειδικό αρχείο το οποίο βοηθάει στην διαφανή επικοινωνία των εφαρμογών επιπέδου χρήστη με το υλικό. Αυτού του είδους τα αρχεία αποκαλούνται device nodes.
71
72
Keflaio 8. LeitourgÐa Sta perissìtera sust mata oi odhgoÐ ja fort¸nontai autìmata me to pou
aniqneÔetai h Ôparxh thc krtac. An autì den gÐnetai autìmata se kpoio sÔsthma, eÐnai dunatìn na anagkasteÐ to sÔsthma na fort¸nei touc odhgoÔc kat thn dirkeia thc ekkÐnhshc me thn paraktw entol . # echo
modprobe dvbm > / e t c / r c . d / r c . l o c a l
Met apì aut n thn diadikasÐa h krta prèpei na eÐnai antistoiqismènh me to
device node /dev/asitx0.
Gia na tropopoihjoÔn oi rujmÐseic thc krtac me
diadrastikì trìpo uprqei h ex c entol : # txcfg
/ dev / a s i t x 0
Tèloc gia na diapistwjeÐ h swst leitourgÐa thc krtac mporeÐ na ektelesteÐ h entol : # mknull
|
txtest
/ dev / a s i t x 0
Me autìn ton trìpo apostèlletai ènac surmìc dedomènwn apì ken pakèta sthn krta kai ètsi eÐnai dunatìn na diapistwjeÐ h leitourgÐa thc.
8.1.2
Suntonismìc
Me thn entol
scan
entopÐzontai ìla ta thleoptik kanlia pou ekpèmpon-
tai apì thn platfìrma
DVB-T,
ìpwc faÐnetai kai sto paraktw
screenshot
.
ParathreÐtai ìti aniqneÔontai 5 thleoptik progrmmata ta opoÐa apojhkeÔontai sth sunèqeia se èna arqeÐo pou to onomzoume Tèloc, me thn entol
tzap,
mychannels.
parèqetai h dunatìthta gia suntonismì se
kpoio apì ta aniqneÔsima progrmmata se mia sugkekrimènh suqnìthta, ìpwc parathreÐtai kai apì to
screenshot
.
8.1.3 dvbnet Gia na gÐnetai autìmata h apoenjulkwsh sthn meri tou qr sth kai h anadromolìghsh twn vbnet.
ta
IP
IP
pakètwn pou anakt jhkan, gÐnetai qr sh tou ergaleÐou
Autì dhmiourgeÐ èna eikonikì diktuakì
interface
ìpou kai dromologeÐ
pakèta ¸ste na epexergastoÔn apì to leitourgikì.
Autì mporeÐ na epiteuqjeÐ me thn paraktw entol .
d-
8.2. LEITOURG'IA # dvbnet
8.2
−U −p
73
336
LeitourgÐa
H efarmog mporeÐ na klhjeÐ apì thn gramm entol¸n me thn akìloujh entol : # . / ipcapx
/ dev / a s i t x 0
To pr¸to ìrisma eÐnai to
26
24
0
device node
0
0
0
gia thn krta pou ja qrhsimopoi-
hjeÐ. Ta epìmena tèssera orÐsmata eÐnai oi aparaÐthtec timèc pou prèpei na oristoÔn, ¸ste h krta na stèlnei se èna sugkekrimèno
bit rate.
timèc mporoÔn na paraqjoÔn dÐnontac wc ìrisma to epijumhtì prìgramma
8.3
calcstu
Autèc oi sto
bit rate
to opoÐo parèqetai mazÐ me touc odhgoÔc thc krtac.
ParametropoÐhsh
Gia na uprqei stajerìc rujmìc dedomènwn, prgma pou apaiteÐ to prwtìkollo ASI,
prèpei na rujmisteÐ h krta ¸ste na eisgei autìmata
null packets
ìtan
ta diajèsima dedomèna den eparkoÔn. Autì mporeÐ na gÐnei me tic akìloujec entolèc. $
su
−
# echo
1 > / sys / c l a s s / a si / asitx0 / nullpackets
Akìma prin staloÔn dedomèna sthn krta, prèpei na brejoÔn oi katllhloi buers.
H diadikasÐa pou akolouj jhke sta plaÐsia aut c thc èreunac peri-
grfetai sto keflaio 7.3.1. An, gia pardeigma, o katllhloc arijmìc buers
eÐnai 6 kai to mègejoc twn
buer
eÐnai 1128, tìte oi
buer
toÔn me tic akìloujec entolèc. $
su
−
# echo
6 > / sys / c l a s s / a si / asitx0 / buffers
# echo
1128 > / s y s / c l a s s / a s i / a s i t x 0 / b u f s i z e
mporoÔn na oris-
74
Keflaio 8. LeitourgÐa
Keflaio 9
ParousÐash metr sewn
9.1
ParousÐash apotelesmtwn
Gia thn axiolìghsh tou diktÔou èginan oi metr seic pou anafèrjhkan. Apì ta apotelèsmata dhmiourg jhkan ta diagrmmata gia thn apìdosh tou diktÔou, ta opoÐa faÐnontai paraktw.
9.1.1
Apìdosh
Apì ta apotelèsmata dhmiourg jhkan ta diagrmmata gia thn apìdosh tou diktÔou, ta opoÐa faÐnontai paraktw. EÐnai profanèc ìti h apìdosh eÐnai kalÔterh ìtan qrhsimopoieÐtai h mèjodoc tou
packing.
Autì sumbaÐnei epeid h mèjodoc tou
na
ULE SNDU
ta
sndus
padding
sumplhr¸nei to upìloipo tou pakètou me
moirzontai an 184
bytes
null bytes.
gia na enjulakwjoÔn sta
to upìloipo thc diaÐreshc tou m kouc tou auxnetai to pl joc twn
ìtan telei¸nei è-
stung bytes
SNDU
TS
Epeid
pakèta, an
me to 184 eÐnai mikrì, tìte
me apotèlesma na mei¸netai h apì-
dosh tou diktÔou. AntÐjeta, an to upìloipo thc diaÐreshc plhsizei to 184, tìte ta
stung bytes
eÐnai ligìtera kai h apìdosh tou diktÔou megalÔterh.
Autì exhgeÐ tic auxomei¸seic sto digramma thc apìdoshc ìso metablletai to mègejoc tou To
packing,
tou epìmenou
IP
pakètou.
an uprqei h dunatìthta, suneqÐzei na topojeteÐ ta dedomèna
SNDU.
Me autìn ton trìpo axiopoieÐtai q¸roc sta 75
TS
pakèta
Keflaio 9. ParousÐash metr sewn
76
pou alli¸c ja p gaine qamènoc. Autì to gegonìc knei thn mèjodo na prosfèrei polÔ kalÔterh apìdosh se sqèsh me to
packing
padding.
Sthn eikìna 9.1 faÐnetai h apìdosh tou diktÔou qrhsimopoi¸ntac thn mèjodo
packing
erqìmenwn
kai thn mèjodo bytes
padding.
proc ta exerqìmena
San apìdosh orÐzetai o lìgoc twn eisbytes.
AfoÔ h diafor aut¸n twn dÔo
uprqei epeid prostÐjetai h plhroforÐa apì to
overhead
thc enjulkwshc,
o lìgoc autìc eÐnai logikì na mac dÐnei thn eikìna thc apìdoshc thc
ULE
enjulkwshc.
1
0.8
Efficiency
0.6
0.4
0.2
Packing Padding 0 0
200
400
600 800 Packet size (Bytes)
1000
1200
1400
Sq ma 9.1: Apìdosh tou diktÔou.
H apìdosh aut eÐnai sÔmfwnh me llec prìsfatec èreunec gia thn apìdosh thc
ULE
enjulkwshc [5].
9.1. PAROUS'IASH APOTELESM'ATWN
9.1.2
77
Kajustèrhsh
H kajustèrhsh eÐnai o qrìnoc pou apaiteÐtai gia to kje pakèto gia na ftsei ston proorismì tou apì thn ¸ra pou xekÐnhse apì ton apostolèa. Oi mèsoi ìroi thc kajustèrhshc gia kje set metr sewn faÐnetai sto digramma 9.2.
160
140
Average one way delay (ms)
120
100
80
60
40
20 Packing Padding 0 0
200
400
600 800 Packet size (Bytes)
1000
1200
1400
Sq ma 9.2: To digramma kajustèrhshc.
'Opwc faÐnetai, me exaÐresh thn perÐptwsh mikroÔ megèjouc pakètwn gia thn mèjodo tou packing, o mèsoc ìroc thc kajustèrhshc tou diktÔou diathreÐtai sqedìn stajer sta 29
ms
anexrthta apì to mègejoc pakètou. 'Ara se
sqèsh me thn kajustèrhsh den faÐnetai kpoia mèjodoc na upertereÐ se sqèsh me mia llh.
Keflaio 9. ParousÐash metr sewn
78
9.1.3
Metabol thc kajustèrhshc
Ed¸ parousizontai ta apotelèsmata thc anlushc gia thn metabol thc kajustèrhshc. Aut h tim apeikonÐzei thn metabol thc kajustèrhshc anmesa se dÔo pakèta. Gia pollèc diktuakèc uphresÐec eÐnai shmantikì h tim aut na paramènei se qamhl epÐpeda. Sthn eikìna 9.3 parousizontai oi mèsec timèc thc metabol c thc kajustèrhshc se sqèsh me to mègejoc pakètou gia tic dÔo mejìdouc enjulkwshc. Ap' ìti faÐnetai apì to digramma h metabol thc kajustèrhshc auxnetai analogik kai sqedìn grammik se sqèsh me to mègejoc tou pakètou.
9
8
7
Average jitter (ms)
6
5
4
3
2
1 Packing Padding 0 0
200
400
600
800 Packet size (Bytes)
1000
1200
Sq ma 9.3: H metabol thc kajustèrhshc.
1400
9.1. PAROUS'IASH APOTELESM'ATWN
9.1.4
79
Ap¸leiec
Oi ap¸leiec tou diktÔou parousizontai sto digramma 9.4. San ap¸leia upologÐzetai èna pakèto to opoÐo den èftase ston proorismì tou. Ta apotelèsmata emfanÐzoun to posostì twn pakètwn pou qjhkan se sqèsh me me ta pakèta pou estlhsan.
14
12
Average losses (%)
10
8
6
4
2 Packing Padding 0 0
200
400
600
800 Packet size (Bytes)
1000
1200
1400
Sq ma 9.4: Oi ap¸leiec tou sust matoc.
EÐnai fanerì ìti to posostì twn qamènwn pakètwn auxnetai ekjetik ìso mei¸netai to mègejoc tou pakètou. Autì, ìpwc, anafèrjhke kai pio pnw, ofeÐletai sto ìti oi
buer
eÐnai rujmismènoi gia èna sugkekrimèno rujmì
metdoshc. An exairejeÐ h perÐptwsh twn polÔ mikr¸n megej¸n pakètwn, parathreÐtai ìti to posostì twn apwlei¸n plhsizei to 0 kai gia touc dÔo tÔpouc enjulkwshc.
Keflaio 9. ParousÐash metr sewn
80
9.2
Sqoliasmìc apotelesmtwn
H apìdosh tou diktÔou eÐnai polÔ kalÔterh me thn mèjodo
packing.
H kajustèrhsh diathreÐtai se polÔ kal epÐpeda se ìla ta megèjh pakètwn kai me tic dÔo mejìdouc. H mình exaÐresh eÐnai ìtan uprqoun roèc me polÔ mikrì mègejoc pakètwn ìpou h kajustèrhsh auxnetai dramatik, all paramènei se anekt epÐpeda. H metabol thc kajustèrhshc diathr jhke se qamhl epÐpeda kai tan anlogh me to mègejoc tou pakètou. Oi timèc thc kumnjhkan apì 0.93 wc 7,20
ms.
ms
Dedomènou ìti gia tic perissìterec uphresÐec anektèc timèc gia
thn metabol thc kajustèrhshc eÐnai apì 100 ms kai ktw, sunepgetai ìti to dÐktuo pou anaptÔqjhke den eÐnai eupajèc stic metabolèc thc kajustèrhshc. ParathroÔntai meglec ap¸leiec gia mikrì mègejoc pakètou. Autì ofeÐletai sto ìti oi
buers
thc krtac èqoun rujmisteÐ gia bèltisth leitourgÐa se
èna sugkekrimèno rujmì metdoshc dedomènwn. 'Oso mei¸netai to mègejoc tou pakètou, ìmwc, tìso auxnetai o rujmìc metdoshc, kaj¸c auxnetai to overhead
an qrìno an pakèto.
Keflaio 10
Sumpersmata
Skopìc aut c thc ptuqiak c ergasÐac tan h metafor diktuak¸n pakètwn pnw apì èna kanli
UHF
me thn teqnologÐa thc yhfiak c thleìrashc. Gia
ton skopì autì kataskeusthke ènac ULE enjulakwt c sÔmfwna me to RFC 4326 kai ulopoi jhke èna prìtupo monìdromo dÐktuo sto opoÐo metadidìtan ta dedomèna se mÐa UHF suqnìthta kai h l yh touc ginìtan apì ènan upologist me ton katllhlo exoplismì. H axiolìghsh thc sumperiforc tou diktÔou sthn metdosh apì shmeÐo se shmeÐo ègine knontac qr sh twn prwtokìllwn UDP/IP.
Ta apotelèsmata twn metr sewn krÐnontai anamenìmena kai eÐnai
sunaf me prohgoÔmenec èreunec. H qrhstikìthta tou diktÔou pou dhmiourg jhke mporeÐ auxhjeÐ dramatik me thn qr sh enìc kanalioÔ epistrof c. Tètoiec arqitektonikèc èqoun dh protajeÐ se prìsfatec èreunec. H teqnologÐa h opoÐa melet jhke kai axiolog jhke sthn paroÔsa ptuqiak ergasÐa mporeÐ na epektajeÐ kai se suggenik prwtìkolla thc epÐgeiac yhfiak c thleìrashc, ìpwc to DVB-H, ¸ste na kalÔyei kai kinhtoÔc qr stec pou diajètoun forhtèc suskeuèc kai epijumoÔn na èqoun diktuakèc uphresÐec. Dedomènhc thc eureÐac perioq c kluyhc thc yhfiak c thleìrashc, eÐnai eÔlogo kai anamenìmeno tètoiou eÐdouc uphresÐec na gÐnoun antikeÐmeno entatikìterhc èreunac.
81
82
Keflaio 10. Sumpersmata
BibliografÐa
[1]
EN 301 192 Digital Video Broadcasting (DVB); Specication for Data Broadcasting
[2]
G. Fairhurst, B. Collini-Nocker, H.D. Clausen, H. Linder, A Framework for transmission of IP datagrams over MPEG-2 networks , IETF Work in Progress, http://www.ietf.org/internet-drafts/draft-fair-ipdvbreq-05.txt
[3]
G. Fairhurst , B. Collini-Nocker. Ultra Lightweight Encapsulation (ULE) for transmission of IP datagrams over MPEG-2/DVB networks , IETF Work in Progress, http://www.ietf.org/internet-drafts/draft-ietfipdvb-ule-01.txt
[4]
TR 101 211 Digital Video Broadcasting (DVB); Guidelines on implementation and usage of Service Information (SI)
[5]
G. Xilouris, G. Gardikis, H. Koumaras and A. Kourtis, Unidirectional Lightweight Encapsulation:
Performance Evaluation and Application
Perspectives , IEEE Transaction on Broadcasting, vol. 52, Issue 3, Sept 2006, pp. 374-380.
[6]
TR 101 162 Digital Video Broadcasting (DVB); Allocation of Service Information (SI) Codes for Digital Video Broadcasting (DVB) Systems
[7]
B. Collini-Nocker, H. Linder, G. Fairhurst, Ultra Lightweight Encapsulation
(ULE)
Extension
Header
IETF
Work
in
Progress,
http://www.ietf.org/internet-drafts/draft- collini-ipdvb-xule-00.txt
83
BibliografÐa
84
[8]
http://www.ist-athena.org/Deliverables/ATHENA%20D3.1%20Final.pdf
HmeromhnÐa teleutaÐac epÐskeyhc: [9]
E Pallis,
C. Mantakas,
06/09/2006
G. Mastorakis,
V. Zacharopoulos,
"Digital
Switchover in UHF: the ATHENA concept for Broadband access", 14th IST Mobile & Wireless Communications Summit 2005, Dresden, 19-23 June, 2005
[10]
http://dast.nlanr.net/Projects/Iperf/
HmeromhnÐa teleutaÐac epÐskeyhc:
08/10/2007
[11]
http://pf.itd.nrl.navy.mil/mgen/
HmeromhnÐa teleutaÐac epÐskeyhc:
08/10/2007
[12]
http://jarok.cs.ohiou.edu/software/tcptrace/
epÐskeyhc: [13]
HmeromhnÐa
teleutaÐac
08/10/2007
ISO/IEC 13818-2, Generic Coding of Moving Pictures and Associated Audio Information (MPEG-2) Part 2: Video , ISO, 1996.
[14]
ISO/IEC 13818-1, Generic Coding of Moving Pictures and Associated Audio Information (MPEG-2) Part 1: Systems , ISO, 1996.
[15]
ETSI EN 300 744, Digital Video Broadcasting (DVB); Framing structure, channel coding and modulation for digital terrestrial television , v1.5.1, ETSI, 2004.
[16]
ETS 300 744, Digital Video Broadcasting (DVB); Framing structure, channel coding and modulation for digital Terrestrial television (DVBT) , ETSI, 1997.
Index alusÐda ekpomp c,
sync byte, 20
51
kuklikìc èlegqoc pleonasmoÔ, see
transport error indicator, 20
crc
transport priority, 21
checksum
transport scrambling control, 21 buer, 52 ULE, 37, 54 crc checksum, 57
ULE
DVB, 25 DVB-T, 25, 27 dvbnet, 64 gnuplot, 65 mgen, 63 MPEG, 13 MPEG-2, 14, 17 pcap, 53 Program Stream, 19 SNDU, 54 tcpdump, 63 transport stream, 19 adaptation eld contol, 21 continuity counter, 21 payload start indicator, 21 PID, 21
85
enjulakwt c,
47
86
Index
Parrthma Aþ
Diagrmmata
87
Parrthma aþ. Diagrmmata 88
One Way Delay (ms) One Way Delay (ms)
30
10
15
20
25
30
35
40
45
50
55
60
65
10
15
20
25
30
45
25
50
20
40
15 Time (sec)
20
30
45
10
15 Time (sec)
(a) padding 150
10
25
35
5
5
40
0
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 225
10
(e) packing 225
25
25
Sq ma Aþ.1: Kajustèrhsh
30
30
One Way Delay (ms) One Way Delay (ms)
35
30
25
20
15
250
200
150
100
50
0
(d) packing 150
One Way Delay (ms) One Way Delay (ms)
70
60
50
40
30
20
10
55
50
45
40
35
30
25
20
15
10
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 300
10
(f ) packing 300
25
25
30
30
10
15
20
25
30
35
40
45
50
55
15
20
25
30
35
40
45
50
55
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(d) packing 375
10
(a) padding 375
10
25
25
30
30
One Way Delay (ms) One Way Delay (ms)
One Way Delay (ms)
One Way Delay (ms)
10
15
20
25
30
35
40
45
50
15
20
25
30
35
40
45
50
55
0
0
15 Time (sec)
20
15 Time (sec)
20
(e) packing 450
10
(b) padding 450
10
25
25
Sq ma Aþ.2: Kajustèrhsh
5
5
30
30
One Way Delay (ms) One Way Delay (ms)
60
10
15
20
25
30
35
40
45
50
55
15
20
25
30
35
40
45
50
55
60
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 525
10
(c) paddind 525
10
25
25
30
30
89
Parrthma aþ. Diagrmmata 90
One Way Delay (ms) One Way Delay (ms)
55
50
45
40
35
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(a) padding 600
10
25
25
30
30
80
70
60
50
40
30
20
10
50
45
40
35
30
25
20
15
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 675
10
(e) packing 675
25
25
Sq ma Aþ.3: Kajustèrhsh
30
30
One Way Delay (ms) One Way Delay (ms)
30
25
20
15
50
45
40
35
30
25
20
15
10
(d) packing 600
One Way Delay (ms) One Way Delay (ms)
55
50
45
40
35
30
25
20
15
50
45
40
35
30
25
20
15
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 750
10
(f ) packing 750
25
25
30
30
10
15
20
25
30
35
40
45
50
55
60
15
20
25
30
35
40
45
50
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(d) packing 825
10
(a) padding 825
10
25
25
30
30
One Way Delay (ms) One Way Delay (ms)
One Way Delay (ms)
One Way Delay (ms)
15
20
25
30
35
40
45
50
55
15
20
25
30
35
40
45
50
55
60
0
0
15 Time (sec)
20
15 Time (sec)
20
(e) packing 900
10
(b) padding 900
10
25
25
Sq ma Aþ.4: Kajustèrhsh
5
5
30
30
One Way Delay (ms) One Way Delay (ms)
55
10
15
20
25
30
35
40
45
15
20
25
30
35
40
45
50
55
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 975
10
(c) paddind 975
10
25
25
30
30
91
Parrthma aþ. Diagrmmata 92
One Way Delay (ms) One Way Delay (ms)
55
50
45
40
35
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(a) padding 1050
10
25
25
30
30
70
60
50
40
30
20
10
50
45
40
35
30
25
20
15
10
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 1125
10
(e) packing 1125
25
25
Sq ma Aþ.5: Kajustèrhsh
30
30
One Way Delay (ms) One Way Delay (ms)
30
25
20
15
10
50
45
40
35
30
25
20
15
(d) packing 1050
One Way Delay (ms) One Way Delay (ms)
60
55
50
45
40
35
30
25
20
15
50
45
40
35
30
25
20
15
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 1200
10
(f ) packing 1200
25
25
30
30
10
15
20
25
30
35
40
45
15
20
25
30
35
40
45
50
55
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(d) packing 1275
10
(a) padding 1275
10
25
25
30
30
One Way Delay (ms) One Way Delay (ms)
One Way Delay (ms)
One Way Delay (ms)
10
15
20
25
30
35
40
45
50
15
20
25
30
35
40
45
50
55
60
0
0
15 Time (sec)
20
15 Time (sec)
20
(e) packing 1350
10
(b) padding 1350
10
25
25
Sq ma Aþ.6: Kajustèrhsh
5
5
30
30
One Way Delay (ms) One Way Delay (ms)
60
10
15
20
25
30
35
40
45
10
15
20
25
30
35
40
45
50
55
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 1425
10
(c) paddind 1425
10
25
25
30
30
93
Parrthma aþ. Diagrmmata 94
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
20
0
5
10
15
20
25
30
35
40
0
2
4
6
8
10
12
20
30
18
25
16
20
18
15 Time (sec)
20
30
16
10
15 Time (sec)
(a) padding 150
10
25
14
5
5
14 12
0
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 225
10
(e) packing 225
25
25
30
30
Sq ma Aþ.7: Metabol kajustèrhshc
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
10 8 6 4 2 0
200 180 160 140 120 100 80 60 40 20 0
(d) packing 150
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
25
20
15
10
5
0
30
25
20
15
10
5
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 300
10
(f ) packing 300
25
25
30
30
15 Time (sec)
20
15 Time (sec)
20
25
25
30
30
(d) packing 375
0
0
5
5
15 Time (sec)
20
10
15 Time (sec)
20
(b) padding 450
10
25
25
30
30
(e) packing 450
Sq ma Aþ.8: Metabol kajustèrhshc
0
5
10
15
20
25
0
10
15
20
25
30
0
0
10
(a) padding 375
10
0
5
5
5
10
15
20
25
30
5
0
0
5
10
15
20
25
30
5
10
15
20
25
30
0
5
10
15
20
25
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
Inter-arrival Jitter (ms)
Packet-to-Packet Delay Varietion (ms)
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 525
10
(c) paddind 525
10
25
25
30
30
95
Parrthma aþ. Diagrmmata 96
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
25
20
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(a) padding 600
10
25
25
30
30
45
40
35
30
25
20
15
5
10
0
30
25
20
15
10
5
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 675
10
(e) packing 675
25
25
30
30
Sq ma Aþ.9: Metabol kajustèrhshc
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
15
10
5
0
30
25
20
15
10
5
0
(d) packing 600
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
25
20
15
10
5
0
30
25
20
15
10
5
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 750
10
(f ) packing 750
25
25
30
30
15 Time (sec)
20
15 Time (sec)
20
25
25
30
30
10
15
20
25
30
0
(d) packing 825
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(e) packing 900
10
(b) padding 900
10
25
25
30
30
Sq ma Aþ.10: Metabol kajustèrhshc
0
10
(a) padding 825
10
0
5
5
5
0
0
5
10
15
20
25
30
35
40
5
10
15
20
25
30
0
5
10
15
20
25
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
Inter-arrival Jitter (ms)
Packet-to-Packet Delay Varietion (ms)
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
0
5
10
15
20
25
0
5
10
15
20
25
30
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 975
10
(c) paddind 975
10
25
25
30
30
97
Parrthma aþ. Diagrmmata 98
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
25
20
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(a) padding 1050
10
25
25
30
30
45
40
35
30
25
20
15
5
10
0
30
25
20
15
10
5
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 1125
10
(e) packing 1125
25
25
30
30
Sq ma Aþ.11: Metabol kajustèrhshc
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
15
10
5
0
30
25
20
15
10
5
0
(d) packing 1050
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
25
20
15
10
5
0
30
25
20
15
10
5
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 1200
10
(f ) packing 1200
25
25
30
30
15 Time (sec)
20
15 Time (sec)
20
25
25
30
30
10
15
20
25
30
0
(d) packing 1275
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(e) packing 1350
10
(b) padding 1350
10
25
25
30
30
Sq ma Aþ.12: Metabol kajustèrhshc
0
10
(a) padding 1275
10
0
5
5
5
0
0
5
10
15
20
25
30
5
10
15
20
25
30
0
5
10
15
20
25
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
Inter-arrival Jitter (ms)
Packet-to-Packet Delay Varietion (ms)
Inter-arrival Jitter (ms) Packet-to-Packet Delay Varietion (ms)
30
0
5
10
15
20
25
0
5
10
15
20
25
30
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 1425
10
(c) paddind 1425
10
25
25
30
30
99
Parrthma aþ. Diagrmmata 100
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
30
0
0
1
2
2
2
3
4
4
0
0
1
2
3
25
3
20
2
15 Time (sec)
20
30
2
10
15 Time (sec)
(a) padding 150
10
25
2
5
5
2
0
0
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(b) padding 225
10
25
25
30
30
4
4
3
2
2
2
1
0
0
4
4
3
2
2
2
1
0
0
0
0
Sq ma Aþ.13: Exomalumènh metabol thc kajustèrhshc
(e) packing 225
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
2
1
0
0
14
12
10
8
6
4
2
0
(d) packing 150
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 300
10
(f ) packing 300
25
25
30
30
0
1
2
3
4
5
6
0
0
1
2
2
2
3
4
4
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(d) packing 375
10
(a) padding 375
10
30
30
0
1
2
3
4
5
6
7
0
0
1
2
2
2
3
4
4
4
5
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(e) packing 450
10
(b) padding 450
10
25
25
30
30
0
1
2
3
4
5
6
0
0
1
2
2
2
3
4
4
4
5
0
0
Sq ma Aþ.14: Exomalumènh metabol thc kajustèrhshc
25
25
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
4
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 525
10
(c) paddind 525
10
25
25
30
30
101
Parrthma aþ. Diagrmmata 102
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
6
5
4
0
0
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(a) padding 600
10
25
25
30
30
25
30
0
1
2
3
4
5
6
7
8
0
1
2
3
4
7
20
7
15 Time (sec)
20
30
6
10
15 Time (sec)
(b) padding 675
10
25
5
5
5
6
0
0
5
4
3
2
1
0
7
6
5
4
3
2
1
0
0
0
Sq ma Aþ.15: Exomalumènh metabol thc kajustèrhshc
(e) packing 675
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
3
2
1
0
6
5
4
3
2
1
0
(d) packing 600
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 750
10
(f ) packing 750
25
25
30
30
0
1
2
3
4
5
6
7
8
0
1
2
3
4
5
6
7
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(d) packing 825
10
(a) padding 825
10
30
30
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(e) packing 900
10
(b) padding 900
10
25
25
30
30
0
1
2
3
4
5
6
7
8
0
1
2
3
4
5
6
7
8
0
0
Sq ma Aþ.16: Exomalumènh metabol thc kajustèrhshc
25
25
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
8
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 975
10
(c) paddind 975
10
25
25
30
30
103
Parrthma aþ. Diagrmmata 104
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
20
25
30
0
0
1
2
3
4
5
6
7
8
9
10
0
1
2
3
4
5
9
15 Time (sec)
8
10
9
5
9
0
7
5
4
3
2
1
0
20
30
8
30
15 Time (sec)
(b) padding 1125
10
25
8
25
5
6
20
9
8
7
6
5
4
3
2
1
0 0
7
15 Time (sec)
20
30
7
10
15 Time (sec)
(a) padding 1050
10
25
6
5
5
6
5
0
0
0
Sq ma Aþ.17: Exomalumènh metabol thc kajustèrhshc
(e) packing 1125
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
4
3
2
1
0
9
8
7
6
5
4
3
2
1
0
(d) packing 1050
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
5
5
10
15 Time (sec)
15 Time (sec)
20
20
(c) paddind 1200
10
(f ) packing 1200
25
25
30
30
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(d) packing 1275
10
(a) padding 1275
10
30
30
0
1
2
3
4
5
6
7
8
9
10
0
1
2
3
4
5
6
7
8
9
10
0
0
5
5
15 Time (sec)
20
15 Time (sec)
20
(e) packing 1350
10
(b) padding 1350
10
25
25
30
30
0
1
2
3
4
5
6
7
8
9
0
0
1
2
3
4
5
6
7
8
9
10
0
Sq ma Aþ.18: Exomalumènh metabol thc kajustèrhshc
25
25
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms)
Inter-arrival Jitter (ms) Inter-arrival Jitter (ms)
9
5
5
15 Time (sec)
20
15 Time (sec)
20
(f ) packing 1425
10
(c) paddind 1425
10
25
25
30
30
105
106
Parrthma aþ. Diagrmmata
Parrthma Bþ
K¸dikec
B.1
ULE Enjulakwt c
B.1.1 ulencap.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# include # include # include # include # include # include # include # include # include
< stdio .h > < stdlib .h > < pcap .h > /* if this gives you an error try pcap / pcap . h */ < errno .h > < sys / socket .h > < netinet / in .h > < arpa / inet .h > < netinet / if_ether .h > /* includes net / ethernet .h */ < time .h > /* strftime */
# include < pthread .h > # include " ulenc .h" # include " stuff_tx . h" # include " buffer .h" # include " captureThread . h" char errbuf [ PCAP_ERRBUF_SIZE ]; char * dev ; pthread_mutex_t mutexfd ; pthread_mutex_t mutexpush ; int main ( int argc , char ** argv ) { pthread_t captIPs [ MAX_IPS ]; char ips [ MAX_IPS ][80]; int streams =0; FILE * fpc ; init_buffer (& ip_buff , 1000 , 1560) ; init_buffer (& ts_buff , 53 , 188) ; 107
108 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
Parrthma bþ. K¸dikec
if ( configure_tx ( argc , argv ) !=0 ){ printf (" Error configuring the card \n"); return 1; } pthread_mutex_init (& mutexfd , NULL ); pthread_mutex_init (& mutexpush , NULL ); init_transmitter () ; //
// // //
//
printf ("\ naaok ") ; fpc = fopen (" ule . conf " , " r"); if ( fpc != NULL ) { int i =0; char ch ; while ( ( ch = fgetc ( fpc )) != EOF ) { if (( ch == '\ n ')) { ips [ streams ][ i ]= ' \0 '; pthread_create (& captIPs [ streams ], NULL , captureIP , ( void *) ips [ streams ]) ; // TODO : pass a struct instead with char ** streams and buffer * pthread_join (& captIPs [ streams ++] , NULL ) ; printf (" ip : %s stream %d\n " , ips [ streams -1] , streams ); i =0; } else { ips [ streams ][ i ++] = ch ; } } fclose ( fpc ); } else { printf (" can 't find configuration file ...\ n\n"); exit (2) ; } pthread_t thr1 ; pthread_create ( & thr1 , NULL , sendPAT , ( void *) streams ); pthread_join ( & thr1 , NULL ); pthread_t thr2 ; pthread_create ( & thr2 , NULL , dequeue , ( void *) NULL ); while (1) { usleep (100000) ; }
}
return 0;
B.1.2 buer.c 1 2 3 4 5
# include " buffer .h" void
B.1.
6 7 8 9 10 11 12 13 14 15 16
b -> head -> length = size >b - > nsize ?b -> nsize : size ; /*
*/ /*
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
109
ENJULAKWT'HS
push ( _buffer * b , unsigned char *d , int size ) { // printf (" addind packet \n ") ; int i; static int pkt ; if ( buffer_full (b)) return ;
17 18 19 20 21 22 23 24
ULE
*/ // }
printf (" before %d :\ n", ++ pkt );
// DEBUG for (i = 0; i < b -> head -> length ; i ++) DEBUG printf ("%02 x% s", d [i ] ,( i +1) %32?" ":"\ n ") ; // DEBUG printf ("\ n ") ; // DEBUG memcpy (b -> head -> data , d , b -> head -> length ); printf (" after %d :\ n", pkt ); DEBUG for (i = 0; i < b -> head -> length ; i ++) DEBUG printf ("%02 x% s", b -> head -> data [i ] ,( i +1) %32?" ":"\ n ") ; DEBUG printf ("\ n ") ; // DEBUG b -> head = b -> head -> next ; printf (" packet added !\ n ") ;
bNode * pop ( _buffer * b) { if ( buffer_empty (b) ) return ( bNode *) NULL ;
}
//
bNode * tmp = b -> tail ; b -> tail = b -> tail -> next ; return tmp ;
int buffer_full ( _buffer * b) { return b -> head -> next == b - > tail ; } int buffer_empty ( _buffer * b) { return b -> head == b - > tail ; } void init_buffer ( _buffer ** b , int length , int nsize ) { int i; *b = malloc ( sizeof ( _buffer )); bNode * tmp = malloc ( sizeof ( bNode ));
// // //
110 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
Parrthma bþ. K¸dikec tmp -> data = malloc ( nsize * sizeof ( unsigned char )) ; (* b) -> head = tmp ; (* b) -> tail = tmp ; for (i =1; i < length ; i ++) { bNode * tmp2 = malloc ( sizeof ( bNode )) ; tmp2 -> data = malloc ( nsize * sizeof ( unsigned char )) ; tmp -> next = tmp2 ; tmp = tmp - > next ; } tmp -> next = (* b) -> head ;
}
(* b) -> length = length ; (* b) -> nsize = nsize ;
B.1.3 captureThread.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
# include # include # include # include
" captureThread . h" " crc .h" " buffer .c" " tspacket . h"
# define WIDTH # define TOPBIT
(8 * sizeof ( crc )) (1 << ( WIDTH - 1) )
# if ( REFLECT_DATA == TRUE ) # undef REFLECT_DATA # define REFLECT_DATA (X) # else # undef REFLECT_DATA # define REFLECT_DATA (X) # endif
(( unsigned char ) reflect (( X ) , 8) ) ( X)
# if ( REFLECT_REMAINDER == TRUE ) # undef REFLECT_REMAINDER # define REFLECT_REMAINDER (X) (( crc ) reflect (( X) , WIDTH )) # else # undef REFLECT_REMAINDER # define REFLECT_REMAINDER (X) (X) # endif
extern int fd ; extern pthread_mutex_t mutexfd ; extern pthread_mutex_t mutexpush ; void * captureIP ( void * salami ) { const char * str = ( char *) salami ; unsigned char * sndu ; int i; printf (" starting thread %s\n" , str ); usleep (100000) ; char * errbuf ; char * dev ; pcap_t * descr ;
B.1.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
ULE
111
ENJULAKWT'HS
const u_char * packet ; struct pcap_pkthdr hdr ; struct ether_header * eptr ; struct bpf_program filter ; bpf_u_int32 netp ;
/* pcap .h */ /* net / ethernet .h */
u_char * ptr ; /* printing out hardware header info */ dev = pcap_lookupdev ( errbuf ); if ( dev == NULL ) { printf (" %s\n" , errbuf ); exit (1) ; } printf (" listening on %s\ n" , dev ); // //
printf (" ok 0\ n ") ; descr = pcap_open_live ( dev , BUFSIZ , 0, -1, errbuf ); printf (" ok 1 \n ") ; if ( descr == NULL ) { printf (" pcap_open_live () : %s\n " , errbuf ) ; exit (1) ; } char tmp [80]; strcat ( tmp , " src host ") ; strcat ( tmp , str ); if ( pcap_compile ( descr , & filter , tmp , 0 , netp ) == -1) { printf (" pcap_compile () error \n "); exit (1) ; } if ( pcap_setfilter ( descr , & filter ) == -1) { printf (" pcap_setfilter : %s\n " , pcap_geterr ( descr ) ); exit (1) ; } while (1) { packet = pcap_next ( descr , & hdr );
//
// //
if ( packet == NULL ) { printf (" Warning : Didn 't grab packet \n"); continue ; exit (1) ; } eptr = ( struct ether_header *) packet ; // TODO : implement my make_sndu () if ( ntohs ( eptr -> ether_type ) == ETHERTYPE_IP ) { send_packet ( packet +14 , hdr . len - 14) ; push ( ip_buff , packet +14 , hdr . len - 14) ; // enqueue ip packet push ( ip_buff , make_sndu ( packet +14 , hdr . len - 14 , 0 x0800 ) , ( hdr . len -14) +8) ; // enqueue ip packet } else if ( ntohs ( eptr - > ether_type ) == ETHERTYPE_ARP ) { printf (" Ethernet type hex :% x dec :% d is an ARP packet \n" , ntohs ( eptr - > ether_type ) , ntohs ( eptr - > ether_type )); } else { printf (" Ethernet type %x not IP " , ntohs ( eptr - > ether_type )); exit (1) ;
112 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
}
Parrthma bþ. K¸dikec
}
}
void * sendPAT ( void FILE * int unsigned long int unsigned char unsigned char unsigned char unsigned char
* ptr ) { ff ; i , j , tmp , counter =0; crcc ; nStr = ( int ) ptr ; patPacket [188]; pmtPacket [188]; sdtPacket [188]; temp [188];
/* *************************************** * PAT Packet *************************************** */
*
patPacket [0] = 0 x47 ; // ts header patPacket [1] = 0 x40 ; patPacket [2] = 0 x00 ; patPacket [3] = 0 x10 ; // PAT header patPacket [4] = 0 x00 ; // PID patPacket [5] = 0 x00 ; // table - id tmp = 5 + nStr *4 + 4; // Section_length patPacket [6] = 0 xb0 | ( tmp > >8) ; patPacket [7] = tmp & 0 xff ; tmp = 0 x0222 ; // Transport_Stream_ID patPacket [8] = tmp > >8; patPacket [9] = tmp &0 xff ; patPacket [10] = 0 xc1 ; patPacket [11] = 0 x00 ; patPacket [12] = 0 x00 ; tmp = 0 x0005 ; // progam_number patPacket [13] = tmp > >8; patPacket [14] = tmp &0 xff ; tmp = 0 xe000 | (0 x30 ); // Program_map_PID patPacket [15] = tmp > >8; patPacket [16] = tmp &0 xff ; for ( i =5; i <17; i ++) { temp [i -5] = patPacket [ i ]; } crcc = dvb_crc32_calc (& patPacket [5] , 17 -5) ; patPacket [17] = crcc > >24; patPacket [18] = ( crcc > >16) &0 xff ; patPacket [19] = ( crcc > >8) &0 xff ; patPacket [20] = crcc &0 xff ; // ba e2 3 e 29 /* patPacket [17] = 0 xba ; * patPacket [18] = 0 xe2 ; * patPacket [19] = 0 x3e ; * patPacket [20] = 0 x29 ; */ /* tmp = 0 xe000 | (0 x48 +(( j -13) /4) ); // Program_map_PID * for ( j =13; j <=( nStr *4) +13; j +=4) { * tmp = 0 x0005 +(( j -13) /4) ; // progam_number * patPacket [j ] = tmp > >8; * patPacket [j +1] = tmp &0 xff ; * tmp = 0 xe000 | (0 x48 +(( j -13) /4) ); // Program_map_PID * patPacket [j +2] = tmp > >8; * patPacket [j +3] = tmp &0 xff ; * } * patPacket [j -4] = 0 x11 ;
B.1.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
ULE
113
ENJULAKWT'HS
* patPacket [j -3] = 0 x11 ; * patPacket [j -2] = 0 x11 ; * patPacket [j -1] = 0 x11 ; */ for (i =21; i <188; i ++) patPacket [i] = 0 xff ; /* *************************************** * PMT Packet *************************************** */ pmtPacket [0] pmtPacket [1] pmtPacket [2] pmtPacket [3]
= = = =
0 x47 ; 0 x40 ; 0 x30 ; 0 x10 ;
*
// ts header
pmtPacket [4] = 0 x00 ; pmtPacket [5] = 0 x02 ; pmtPacket [6] = 0 xb0 ; // pmtPacket [7] = 0 x00 ; // tmp = 0 x0005 ; // pmtPacket [8] = tmp > >8; pmtPacket [9] = tmp &0 xff ; pmtPacket [10] = 0 xff ; pmtPacket [11] = 0 x00 ; pmtPacket [12] = 0 x00 ; tmp = 0 x1fff ; // pmtPacket [13] = 0 xe5 | ( tmp > >8) ; pmtPacket [14] = tmp &0 xff ; tmp = 0 x0000 ; // pmtPacket [15] = 0 xf0 | ( tmp > >8) ; pmtPacket [16] = tmp &0 xff ; // replace
fix section_length later program_Number
PCR_PID program_info_length with for for file data
for ( j =17 , i =0; i < nStr ; i ++) { pmtPacket [j ++] = 0 x0c ; tmp = 0 x150 + i; // elementary_PID pmtPacket [j ++] = 0 xe0 | ( tmp > >8) ; pmtPacket [j ++] = tmp &0 xff ; tmp = 0 x0000 ; // ES_info_length ( rep with for ) pmtPacket [j ++] = 0 xf0 | ( tmp > >8) ; pmtPacket [j ++] = tmp &0 xff ; } tmp = j -4; // section_length pmtPacket [6] = 0 xb0 | ( tmp > >8) ; // fix pmtPacket [7] = tmp &0 xff ; for ( i =5; i >24; pmtPacket [j ++] = ( crcc > >16) &0 xff ; pmtPacket [j ++] = ( crcc > >8) &0 xff ; pmtPacket [j ++] = crcc &0 xff ; // df 1a ef c0 /* pmtPacket [j ++] = 0 xdf ; * pmtPacket [j ++] = 0 x1a ; * pmtPacket [j ++] = 0 xef ; * pmtPacket [j ++] = 0 xc0 ; */ for ( i=j; i <188; i ++) pmtPacket [i ] = 0 xff ; /* *************************************** * SDT Packet *************************************** */
*
114 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
Parrthma bþ. K¸dikec
sdtPacket [0] = 0 x47 ; // ts header sdtPacket [1] = 0 x40 ; sdtPacket [2] = 0 x11 ; sdtPacket [3] = 0 x10 ; // SDT header sdtPacket [4] = 0 x00 ; // sdtPacket [5] = 0 x42 ; // table - id sdtPacket [6] = 0 xb0 ; // fix sdtPacket [7] = 0 x00 ; // section_length later tmp = 0 x0222 ; // transport stream id sdtPacket [8] = tmp > >8; sdtPacket [9] = tmp &0 xff ; sdtPacket [10] = 0 xc1 ; sdtPacket [11] = 0 x00 ; sdtPacket [12] = 0 x00 ; tmp = 0 x1234 ; // original_network_id sdtPacket [13] = tmp > >8; sdtPacket [14] = tmp &0 xff ; sdtPacket [15] = 0 xff ; tmp = 0 x0005 ; // service_id sdtPacket [16] = tmp > >8; sdtPacket [17] = tmp &0 xff ; sdtPacket [18] = 0 xfc ; sdtPacket [19] = 0 x80 ; sdtPacket [20] = 0 x15 ; // descriptors_loop_length sdtPacket [21] = 0 x48 ; // dvb desc tag sdtPacket [22] = 0 x13 ; // descriptor length sdtPacket [23] = 0 x0c ; // service_type sdtPacket [24] = 0 x06 ; // service_provider_name_length sdtPacket [25] = 'n '; sdtPacket [26] = 'k '; sdtPacket [27] = 'v '; sdtPacket [28] = 'o '; sdtPacket [29] = 'r '; sdtPacket [30] = 'n '; sdtPacket [31] = 0 x0a ; // service_name_length sdtPacket [32] = 'D '; sdtPacket [33] = 'V '; sdtPacket [34] = 'B '; sdtPacket [35] = ' '; sdtPacket [36] = 'h '; sdtPacket [37] = 'a '; sdtPacket [38] = 'c '; sdtPacket [39] = 'k '; sdtPacket [40] = 'e '; sdtPacket [41] = 'r '; tmp = 46 -8; // section_length sdtPacket [6] = 0 xb0 | ( tmp > >8) ; // fix sdtPacket [7] = tmp &0 xff ; crcc = dvb_crc32_calc (& sdtPacket [5] , 42 -5) ; sdtPacket [42] = crcc > >24; sdtPacket [43] = ( crcc > >16) &0 xff ; sdtPacket [44] = ( crcc > >8) &0 xff ; sdtPacket [45] = crcc &0 xff ; for ( i =46; i <188; i ++) sdtPacket [i ] = 0 xff ;
//
// // //
ff = fopen (" out " ," wb ") ; while (1) { patPacket [3] = 0 x10 | counter ; pmtPacket [3] = 0 x10 | counter ; sdtPacket [3] = 0 x10 | counter ; printf (" crc %04 x \n", calc_crc ( patPacket , 16) ); printf (" crc %04 x \n", calc_crc ( pmtPacket , 16) ); printf (" crc %04 x \n", calc_crc ( sdtPacket , 16) );
B.1.
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
ULE
/* * * * * * * * * * * * *
} // // // // // // // // }
115
ENJULAKWT'HS
for ( i =0; i <188; i ++) printf ("%02 x%s", patPacket [ i], (i +1) %16?" ":"\ n ") ; printf ("\ n ") ; for ( i =0; i <188; i ++) printf ("%02 x%s", pmtPacket [ i], (i +1) %16?" ":"\ n ") ; printf ("\ n ") ; for ( i =0; i <188; i ++) printf ("%02 x%s", sdtPacket [ i], (i +1) %16?" ":"\ n ") ; printf ("\ n ") ; fwrite ( patPacket , sizeof ( patPacket [0]) , sizeof ( patPacket ) , ff ); fwrite ( pmtPacket , sizeof ( patPacket [0]) , sizeof ( patPacket ) , ff ); fwrite ( sdtPacket , sizeof ( pmtPacket [0]) , sizeof ( pmtPacket ) , ff ); fflush ( ff ); */
pthread_mutex_lock (& mutexfd ) ; send_tp ( patPacket ); send_tp ( pmtPacket ); send_tp ( sdtPacket ); pthread_mutex_unlock (& mutexfd ); usleep (100000) ; counter = ++ counter % 16; while (1) { printf (" Streams in PAT (% d ): ", nStr ); for (i =0; i < nStr ; i ++) { printf ("0 x %03 x " , 100+ i); } printf ("\ n ") ; usleep (900000) ; }
unsigned int dvb_crc_table [256] = { 0 x00000000 , 0 x04c11db7 , 0 x09823b6e , 0 x130476dc , 0 x17c56b6b , 0 x1a864db2 , 0 x2608edb8 , 0 x22c9f00f , 0 x2f8ad6d6 , 0 x350c9b64 , 0 x31cd86d3 , 0 x3c8ea00a , 0 x4c11db70 , 0 x48d0c6c7 , 0 x4593e01e , 0 x5f15adac , 0 x5bd4b01b , 0 x569796c2 , 0 x6a1936c8 , 0 x6ed82b7f , 0 x639b0da6 , 0 x791d4014 , 0 x7ddc5da3 , 0 x709f7b7a , 0 x9823b6e0 , 0 x9ce2ab57 , 0 x91a18d8e , 0 x8b27c03c , 0 x8fe6dd8b , 0 x82a5fb52 , 0 xbe2b5b58 , 0 xbaea46ef , 0 xb7a96036 , 0 xad2f2d84 , 0 xa9ee3033 , 0 xa4ad16ea , 0 xd4326d90 , 0 xd0f37027 , 0 xddb056fe , 0 xc7361b4c , 0 xc3f706fb , 0 xceb42022 , 0 xf23a8028 , 0 xf6fb9d9f , 0 xfbb8bb46 , 0 xe13ef6f4 , 0 xe5ffeb43 , 0 xe8bccd9a , 0 x34867077 , 0 x30476dc0 , 0 x3d044b19 , 0 x278206ab , 0 x23431b1c , 0 x2e003dc5 , 0 x128e9dcf , 0 x164f8078 , 0 x1b0ca6a1 , 0 x018aeb13 , 0 x054bf6a4 , 0 x0808d07d , 0 x7897ab07 , 0 x7c56b6b0 , 0 x71159069 , 0 x6b93dddb , 0 x6f52c06c , 0 x6211e6b5 , 0 x5e9f46bf , 0 x5a5e5b08 , 0 x571d7dd1 , 0 x4d9b3063 , 0 x495a2dd4 , 0 x44190b0d , 0 xaca5c697 , 0 xa864db20 , 0 xa527fdf9 , 0 xbfa1b04b , 0 xbb60adfc , 0 xb6238b25 , 0 x8aad2b2f , 0 x8e6c3698 , 0 x832f1041 ,
0 x0d4326d9 , 0 x1e475005 , 0 x2b4bcb61 , 0 x384fbdbd , 0 x4152fda9 , 0 x52568b75 , 0 x675a1011 , 0 x745e66cd , 0 x95609039 , 0 x8664e6e5 , 0 xb3687d81 , 0 xa06c0b5d , 0 xd9714b49 , 0 xca753d95 , 0 xff79a6f1 , 0 xec7dd02d , 0 x39c556ae , 0 x2ac12072 , 0 x1fcdbb16 , 0 x0cc9cdca , 0 x75d48dde , 0 x66d0fb02 , 0 x53dc6066 , 0 x40d816ba , 0 xa1e6e04e , 0 xb2e29692 , 0 x87ee0df6 ,
116 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
};
Parrthma bþ. K¸dikec 0 x99a95df3 , 0 xe0b41de7 , 0 xf3b06b3b , 0 xc6bcf05f , 0 xd5b88683 , 0 x690ce0ee , 0 x7a089632 , 0 x4f040d56 , 0 x5c007b8a , 0 x251d3b9e , 0 x36194d42 , 0 x0315d626 , 0 x1011a0fa , 0 xf12f560e , 0 xe22b20d2 , 0 xd727bbb6 , 0 xc423cd6a , 0 xbd3e8d7e , 0 xae3afba2 , 0 x9b3660c6 , 0 x8832161a , 0 x5d8a9099 , 0 x4e8ee645 , 0 x7b827d21 , 0 x68860bfd , 0 x119b4be9 , 0 x029f3d35 , 0 x3793a651 , 0 x2497d08d , 0 xc5a92679 , 0 xd6ad50a5 , 0 xe3a1cbc1 , 0 xf0a5bd1d , 0 x89b8fd09 , 0 x9abc8bd5 , 0 xafb010b1 , 0 xbcb4666d ,
0 x9d684044 , 0 xe4750050 , 0 xf771768c , 0 xc27dede8 , 0 xd1799b34 , 0 x6dcdfd59 , 0 x7ec98b85 , 0 x4bc510e1 , 0 x58c1663d , 0 x21dc2629 , 0 x32d850f5 , 0 x07d4cb91 , 0 x14d0bd4d , 0 xf5ee4bb9 , 0 xe6ea3d65 , 0 xd3e6a601 , 0 xc0e2d0dd , 0 xb9ff90c9 , 0 xaafbe615 , 0 x9ff77d71 , 0 x8cf30bad , 0 x594b8d2e , 0 x4a4ffbf2 , 0 x7f436096 , 0 x6c47164a , 0 x155a565e , 0 x065e2082 , 0 x3352bbe6 , 0 x2056cd3a , 0 xc1683bce , 0 xd26c4d12 , 0 xe760d676 , 0 xf464a0aa , 0 x8d79e0be , 0 x9e7d9662 , 0 xab710d06 , 0 xb8757bda ,
0 x902b669d , 0 xe9362689 , 0 xfa325055 , 0 xcf3ecb31 , 0 xdc3abded , 0 x608edb80 , 0 x738aad5c , 0 x46863638 , 0 x558240e4 , 0 x2c9f00f0 , 0 x3f9b762c , 0 x0a97ed48 , 0 x19939b94 , 0 xf8ad6d60 , 0 xeba91bbc , 0 xdea580d8 , 0 xcda1f604 , 0 xb4bcb610 , 0 xa7b8c0cc , 0 x92b45ba8 , 0 x81b02d74 , 0 x5408abf7 , 0 x470cdd2b , 0 x7200464f , 0 x61043093 , 0 x18197087 , 0 x0b1d065b , 0 x3e119d3f , 0 x2d15ebe3 , 0 xcc2b1d17 , 0 xdf2f6bcb , 0 xea23f0af , 0 xf9278673 , 0 x803ac667 , 0 x933eb0bb , 0 xa6322bdf , 0 xb5365d03 ,
0 x94ea7b2a , 0 xedf73b3e , 0 xfef34de2 , 0 xcbffd686 , 0 xd8fba05a , 0 x644fc637 , 0 x774bb0eb , 0 x42472b8f , 0 x51435d53 , 0 x285e1d47 , 0 x3b5a6b9b , 0 x0e56f0ff , 0 x1d528623 , 0 xfc6c70d7 , 0 xef68060b , 0 xda649d6f , 0 xc960ebb3 , 0 xb07daba7 , 0 xa379dd7b , 0 x9675461f , 0 x857130c3 , 0 x50c9b640 , 0 x43cdc09c , 0 x76c15bf8 , 0 x65c52d24 , 0 x1cd86d30 , 0 x0fdc1bec , 0 x3ad08088 , 0 x29d4f654 , 0 xc8ea00a0 , 0 xdbee767c , 0 xeee2ed18 , 0 xfde69bc4 , 0 x84fbdbd0 , 0 x97ffad0c , 0 xa2f33668 , 0 xb1f740b4
unsigned long dvb_crc32_calc ( const unsigned char * sectbuf , unsigned int size ) { unsigned long crc32 = 0 xffffffff ; unsigned int i = 0; for (i = 0; i < size ; i ++) crc32 = ( crc32 << 8) ^ dvb_crc_table [((( crc32 >> 24) ^ sectbuf [i ]) & 0 xff ) ]; }
return crc32 ;
void dequeue () { bNode * sndus [16]; ts_pkt * tp ; static unsigned char pkt [188]; unsigned char tmp [188]; int len =0 , rem =0 , i , k , j , f , prev =0 , pos =0 , snd =0; int packing = 1, count , firstPaddPack = 0; static long bytes_in = 0; static long bytes_out = 0;
B.1.
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
ULE
117
ENJULAKWT'HS
int ippacks = 0 , tspacks = 0; pkt [0] = 0 x47 ; pkt [1] = 0 x1f ; pkt [2] = 0 xff ; pkt [3] = 0 x10 ; for (i = 4; i < 188; i ++) pkt [i] = 0 xff ; //
printf ("\ t\t\t \t ==== in dequeue () ====\ n ") ; tp = malloc ( sizeof ( ts_pkt *) ); for (i =0; i <16; i ++) sndus [i] = malloc ( sizeof ( bNode *) );
//
printf ("\ tdequeue 1\ n ") ; tp - > sync = 0 x47 ; tp - > tr_err_ind = 0 x0 ; tp - > tr_prio = 0 x0 ; tp - > pid = 0 x150 ; tp - > ad_field = 0 x0 ; tp - > tr_sc_ctrl = 0 x0 ;
// DEBUG
// DEBUG
while (1) { //
usleep (10000) ; printf ("\ tdequeue 3 em =% d ! pr =% d\ n", ! buffer_empty ( ip_buff ) , prev ); // DEBUG while (! buffer_empty ( ip_buff ) || prev ) { firstPaddPack = 1; // printf ("\ tdequeue main loop \n ") ; // DEBUG pos = 0; // printf ("\ tdequeue 3 prev =% d\n" , prev ); // DEBUG if (! prev ) { sndus [0] = pop ( ip_buff ); bytes_in += sndus [0] - > length ; ++ ippacks ; // printf ("\ n --- poped packet of %d bytes - - -\ n" , sndus [0] - > length ) ; // DEBUG // for (i = 0; i < sndus [0] - > length ; i ++) // DEBUG // printf ("%02 x%s", sndus [0] - > data [i ] ,( i +1) %32?" ":"\ n ") ; // DEBUG // printf ("\ n ") ; // DEBUG // printf ("\ tdequeue 3.0 %d\ n", sndus [0] - > length ) ; // DEBUG len = sndus [0] - > length ; // printf ("\ tdequeue 3.1\ n ") ; // DEBUG if ( len >= 183) { tp - > data [0] = 0; tp - > cc = ++ count % 16; tp - > pusi = 1; if (! packing ) firstPaddPack = 0; // printf ("\ tdequeue 3.2 i =% d pos =% d\n ", i , pos ); // DEBUG for ( i = 1; i < 184; i ++) tp - > data [ i] = sndus [0] - > data [ pos ++]; ts_data ( tp , tmp ); pthread_mutex_lock (& mutexpush ); push ( ts_buff , tmp ,188) ; pthread_mutex_unlock (& mutexpush );
118 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
Parrthma bþ. K¸dikec
} } else { len = sndus [0] - > length ; pos = prev ; // printf ("\ tdequeue 3p prev =% d len =% d \n", prev , len ); // DEBUG prev = 0; } while ( len - pos >184) { // printf ("\ tdequeue 4\ n ") ; // DEBUG // if ( prev ) // prev = 0; tp - > cc = ++ count % 16; tp - > pusi = 0; for ( i = 0; i < 184; i ++) tp - > data [ i] = sndus [0] - > data [ pos ++]; ts_data ( tp , tmp ); pthread_mutex_lock (& mutexpush ); push ( ts_buff , tmp ,188) ; pthread_mutex_unlock (& mutexpush ); } if ( len - pos >0) { // printf ("\ tdequeue pack =% d len - pos =% d \n", packing , len - pos ); // DEBUG if ( packing && len - pos < 182) { // printf ("\ tdequeue 5 em =% d \n " ,! buffer_empty ( ip_buff )) ; // DEBUG snd = 0; int lng = len - pos ; while (! buffer_empty ( ip_buff )) { sndus [++ snd ] = pop ( ip_buff ); bytes_in += sndus [ snd -1] - > length ; ++ ippacks ; // printf ("\ n --- poped packet of %d bytes - - -\ n" , sndus [ snd ] -> length ); // DEBUG // for (i = 0; i < sndus [ snd ]- > length ; i ++) // DEBUG // printf ("%02 x%s", sndus [ snd ]-> data [i ] ,( i +1) %32?" ":"\ n ") ; // DEBUG // printf ("\ n ") ; // DEBUG lng += sndus [ snd ]-> length ; // printf ("\ t \t\ tlng =% d\ n", lng ); // DEBUG if ( lng > 183) break ; } // printf ("\ tdequeue 5.1 snd =% d lng =% d \n", snd , lng ); // DEBUG tp - > data [0] = len - pos ; // printf (" - - start - - - - - -") ; // DEBUG for ( j = 1; j < 184; j ++) { if ( len - pos > 0) { tp - > data [j] = sndus [0] - > data [ pos ++]; // printf ("[% d ,% d ]%02 x ",j , pos , sndus [0] - > data [ pos -1]) ; // DEBUG } else break ; } if ( snd > 0) { k =0;
B.1.
ULE
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
while (++ k <= snd ) { f =0; while (f < sndus [k] -> length ) { // printf ("%02 x ", sndus [k]-> data [f ]) ; DEBUG // printf ("(% d ,% d) ",j , f); // DEBUG tp - > data [ j ++] = sndus [k ]-> data [f ++]; if (j >184) { prev = f -1; sndus [0] = sndus [k ]; goto out ; } } } prev = 0;
out :
}
119
ENJULAKWT'HS
//
// printf (" - - - - end - - - - - -\ n ") ; // DEBUG for (i =j -1; i <184; i ++) tp - > data [ i] = 0 xFF ; } else { for (i =j; i <184; i ++) tp - > data [ i] = 0 xFF ; } tp - > pusi = 1; } else { // padding // printf ("\ t ! padding \n ") ; // DEBUG tp - > pusi = firstPaddPack ; for (j = 0; j < 184; j ++) { if ( len - pos >= 0) tp - > data [ j] = sndus [0] - > data [ pos ++]; else break ; } for (i =j -1; i <=184; i ++) tp - > data [ i] = 0 xFF ; } tp - > cc = ++ count % 16; ts_data ( tp , tmp ); pthread_mutex_lock (& mutexpush ); push ( ts_buff , tmp ,188) ; pthread_mutex_unlock (& mutexpush );
while (! buffer_full ( ts_buff )) { pthread_mutex_lock (& mutexpush ); ++ tspacks ; push ( ts_buff , pkt ,188) ; pthread_mutex_unlock (& mutexpush ); }
/*
*/
bNode * ttmp ; ttmp = malloc ( sizeof ( bNode *) ); while (! buffer_empty ( ts_buff )) { ttmp = pop ( ts_buff ); for ( i = 0; i < 188; i ++) // DEBUG printf ("%02 x%s ", ttmp -> data [i ] ,( i +1) %32?" ":"\ n ") ; // DEBUG printf ("\ n ") ; // DEBUG pthread_mutex_lock (& mutexfd ) ; send_tp ( ttmp - > data ) ;
120 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
Parrthma bþ. K¸dikec
}
// //
pthread_mutex_unlock (& mutexfd );
// edo einai ta null printf ("\ t --- buf em %d , pkt \n ", buffer_empty ( ip_buff )); if (++ count %100) { printf (" bytes in :\ t %d\n" , bytes_in ); printf (" bytes out :\ t%d\n " , tspacks *188) ; } }
} /* unsigned char * null_pkt ( unsigned char * pkt ) { int i; pkt [0] = 0 x47 ; pkt [1] = 0 x1f ; pkt [2] = 0 xff ; pkt [3] = 0 x10 ; for ( i = 4; i < 188; i ++) pkt [i] = 0 xff ; } */
return pkt ;
void ts_data ( ts_pkt * ts , unsigned char * tmp ) { int i ; static int cnt = 0; // printf ("\ t in ts_data () packet # %07 d\ n", ++ cnt ) ;
// DEBUG
* tmp = ts -> sync ; *( tmp +1) = (ts -> tr_err_ind & 0 x1 ) << 7 | (ts -> pusi & 0 x1 ) << 6 | (ts -> tr_prio & 0 x1 ) << 5 | (ts -> pid >> 8) & 0 x1F ; *( tmp +2) = ts -> pid & 0 xFF ; *( tmp +3) = (ts -> tr_sc_ctrl & 0 x3 ) << 6 | (ts -> ad_field & 0 x3 ) << 4 | ts - > cc & 0 xF ; for ( i = 4; i < 188; i ++) { *( tmp +i ) = ts -> data [i -4]; } /*
*/ }
for ( i = 0; i < 188; i ++) printf ("%02 x%s ", tmp [i ] ,( i +1) %32?" ":"\ n ") ; printf ("\ n ") ;
// DEBUG // DEBUG // DEBUG
B.1.
ULE
ENJULAKWT'HS
121
B.1.4 stu_tx.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
# include # include # include # include # include # include # include # include # include
< stdio .h > < stdlib .h > < unistd .h > < fcntl .h > < string .h > < sys / ioctl .h > < sys / stat .h > < sys / poll .h > < sys / time .h >
# include " asi .h" # include " master .h" # include " util .h" # define BUFLEN 256 static const char progname [] = " txtest ";
int configure_tx ( int argc , char ** argv ) {
const char fmt [] = "/ sys / class / asi / asitx %i /% s "; int opt ; int fd , period , quiet , seconds , verbose , packetsize , num ; unsigned long int bufsize , mode , clksrc , timestamps , transport ; int read_ret , write_ret , val ; unsigned int bytes_per_sec ; struct stat buf ; unsigned char * data ; struct asi_txstuffing stuffing ; struct timeval tv ; unsigned int cap , bytes_written , bytes_read , bytes ; struct pollfd pfd ; double status_bytes , bitrate , time_sec , lasttime , dt ; char name [ BUFLEN ], str [ BUFLEN ], * endptr ; /* Parse the command line */ period = 0; quiet = 0; seconds = -1; verbose = 0; while (( opt = getopt ( argc , argv , " hn : qs : vV ")) != -1) { switch ( opt ) { case 'h ': printf ( " Usage : %s [ OPTION ]... DEVICE_FILE [ IB IP \n " "\t [ NORMAL_IP BIG_IP [ IL_NORMAL IL_BIG ]]]\ n" , argv [0]) ; printf ( " Copy standard input to DEVICE_FILE " " with interbyte stuffing IB ,\ n " " interpacket stuffing " " IP + ( BIG_IP / ( BIG_IP + NORMAL_IP ) ) ,\n" " and interleaved finetuning parameters " " IL_NORMAL and IL_BIG \n" " while monitoring for "
122 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
Parrthma bþ. K¸dikec
case
case case
case case
case }
}
" DVB ASI transmitter events .\ n \n"); printf (" -h \t\ tdisplay this help and exit \n "); printf (" -n TIME \ tstop transmitting " " after TIME seconds \n"); printf (" -q \t\ tquiet operation \n "); printf (" -s PERIOD \ tdisplay status " " every PERIOD seconds \n") ; printf (" -v \t\ tverbose output \n" ); printf (" -V \t\ toutput version information " " and exit \n"); printf ("\ nIf TIME < 0, transmission never stops " "( default ) .\ n" ); printf ("\ nReport bugs to < support@linsys .ca >.\ n"); return 0; 'n ': seconds = strtol ( optarg , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid timeout : %s\ n" , argv [0] , optarg ); return -1; } break ; 'q ': quiet = 1; break ; 's ': period = strtol ( optarg , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid period : %s\n " , argv [0] , optarg ); return -1; } break ; 'v ': verbose = 1; break ; 'V ': printf ( "%s from master -% s (% s)\n" , progname , MASTER_DRIVER_VERSION , MASTER_DRIVER_DATE ); printf ( "\ nCopyright (C) 2000 -2005 " " Linear Systems Ltd .\ n" " This is free software ; " " see the source for copying conditions . " " There is NO \n " " warranty ; not even for MERCHANTABILITY " " or FITNESS FOR A PARTICULAR PURPOSE .\ n") ; return 0; '? ': goto USAGE ;
/* Check the number of arguments */ if ((( argc - optind ) == 2) || (( argc - optind ) == 4) || (( argc - optind ) == 6) ) { if (! quiet ) { fprintf ( stderr , "%s: missing arguments \n" , argv [0]) ;
B.1.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
ULE
ENJULAKWT'HS
123
goto USAGE ; } return -1; } else if (( argc - optind ) > 7) { if (! quiet ) { fprintf ( stderr , "%s: extra operand \n" , argv [0]) ; goto USAGE ; } return -1; } /* Read the stuffing parameters */ memset (& stuffing , 0, sizeof ( stuffing )); if (( argc - optind ) > 2) { stuffing . ib = strtol ( argv [ optind + 1] , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid interbyte stuffing : %s\ n" , argv [0] , argv [ optind + 1]) ; return -1; } stuffing . ip = strtol ( argv [ optind + 2] , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid interpacket stuffing : % s\n" , argv [0] , argv [ optind + 2]) ; return -1; } } if (( argc - optind ) > 4) { stuffing . normal_ip = strtol ( argv [ optind + 3] , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid finetuning parameter : % s\n" , argv [0] , argv [ optind + 3]) ; return -1; } stuffing . big_ip = strtol ( argv [ optind + 4] , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid finetuning parameter : % s\n" , argv [0] , argv [ optind + 4]) ; return -1; } if ( stuffing . normal_ip == 0) { stuffing . big_ip = 0; } if (( argc - optind ) > 6) { stuffing . il_normal = strtol ( argv [ optind + 5] , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr , "%s : invalid interleaving parameter : " "%s \n" , argv [0] , argv [ optind + 5]) ; return -1; } stuffing . il_big = strtol ( argv [ optind + 6] , & endptr , 0) ; if (* endptr != '\0 ') { fprintf ( stderr ,
124
Parrthma bþ. K¸dikec
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
}
}
}
"%s : invalid interleaving parameter : " "%s \n" , argv [0] , argv [ optind + 6]) ; return -1;
/* Get the sysfs info */ memset (& buf , 0, sizeof ( buf )); if ( stat ( argv [ optind ] , & buf ) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to get the file status ") ; } return -1; } if (! S_ISCHR ( buf . st_mode )) { if (! quiet ) { fprintf ( stderr , "%s: not a character device \n" , argv [0]) ; } return -1; } if ( buf . st_rdev & 0 x0080 ) { if (! quiet ) { fprintf ( stderr , "%s: not a transmitter \n" , argv [0]) ; } return -1; } num = buf . st_rdev & 0 x007f ; snprintf ( name , sizeof ( name ) , fmt , num , " dev "); memset ( str , 0, sizeof ( str )); if ( util_read ( name , str , sizeof ( str )) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror ( " unable to get the device number "); } return -1; } if ( strtoul ( str , & endptr , 0) != ( buf . st_rdev >> 8) ) { if (! quiet ) { fprintf ( stderr , "%s: not an ASI device \n" , argv [0]) ; } return -1; } if (* endptr != ': ') { if (! quiet ) { fprintf ( stderr , "%s: error reading %s\ n" , argv [0] , name ); } return -1; } /* Open the file */ if ( verbose && ! quiet ) { printf ( " Opening %s .\ n" , argv [ optind ]) ; } if (( fd = open ( argv [ optind ], O_WRONLY , 0) ) < 0) {
B.1.
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
ULE
}
125
ENJULAKWT'HS if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to open file for writing "); } return -1;
/* Get the transport type */ snprintf ( name , sizeof ( name ) , fmt , num , if ( util_strtoul ( name , & transport ) < 0) if (! quiet ) { fprintf ( stderr , "%s: " , perror (" unable to get " " the transmitter } close ( fd ) ; return -1; }
" transport "); { argv [0]) ; transport type ");
/* Get the transmitter capabilities */ if ( ioctl ( fd , ASI_IOC_TXGETCAP , & cap ) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to get the transmitter capabilities " ); } close ( fd ) ; return -1; } /* Get the buffer size */ snprintf ( name , sizeof ( name ) , fmt , num , " bufsize "); if ( util_strtoul ( name , & bufsize ) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to get " " the transmitter buffer size ") ; } close ( fd ) ; return -1; } /* Get the output packet size */ snprintf ( name , sizeof ( name ) , fmt , num , " mode ") ; if ( util_strtoul ( name , & mode ) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to get " " the transmitter operating mode "); } close ( fd ) ; return -1; } switch ( mode ) { case ASI_CTL_TX_MODE_188 : if ( verbose && ! quiet ) { printf (" Assuming 188 - byte packets .\ n"); } packetsize = 188; break ; case ASI_CTL_TX_MODE_204 : if ( verbose && ! quiet ) {
126 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
Parrthma bþ. K¸dikec printf (" Assuming 204 - byte packets .\ n"); } packetsize = 204; break ; case ASI_CTL_TX_MODE_MAKE204 : if ( verbose && ! quiet ) { printf (" Appending sixteen 0 x00 bytes to each " " 188 - byte packet .\ n "); } packetsize = 204; break ; default : if (! quiet ) { fprintf ( stderr , "%s: " " unknown transmitter operating mode \ n" , argv [0]) ; } close ( fd ) ; return -1; } /* Get the clock source */ if ( cap & ASI_CAP_TX_SETCLKSRC ) { snprintf ( name , sizeof ( name ) , fmt , num , " clock_source "); if ( util_strtoul ( name , & clksrc ) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror ( " unable to get " " the clock source ") ; } close ( fd ) ; return -1; } } else { clksrc = 0; } if ( verbose && ! quiet ) { switch ( clksrc ) { case ASI_CTL_TX_CLKSRC_ONBOARD : printf ( " Using onboard oscillator .\ n"); break ; case ASI_CTL_TX_CLKSRC_EXT : printf ( " Using external NTSC or 27 MHz reference .\ n " ); break ; case ASI_CTL_TX_CLKSRC_RX : printf ( " Using recovered receive clock .\ n"); break ; case ASI_CTL_TX_CLKSRC_EXT_PAL : printf ( " Using external PAL reference .\ n "); break ; default : printf ( " Unknown clock source .\ n"); break ; } } /* Get the packet timestamping mode */ if ( cap & ASI_CAP_TX_TIMESTAMPS ) { snprintf ( name , sizeof ( name ) , fmt , num , " timestamps ") ; if ( util_strtoul ( name , & timestamps ) < 0) { if (! quiet ) {
B.1.
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
ULE
127
ENJULAKWT'HS fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to get " " the packet timestamping mode " );
} else {
}
} close ( fd ) ; return -1;
timestamps = ASI_CTL_TSTAMP_NONE ; } if ( verbose && ! quiet ) { switch ( timestamps ) { case ASI_CTL_TSTAMP_NONE : break ; case ASI_CTL_TSTAMP_APPEND : printf (" Stripping eight bytes " " from the end of each packet .\ n"); break ; case ASI_CTL_TSTAMP_PREPEND : printf (" Releasing packets according to " " prepended timestamps .\ n" ); break ; default : printf (" Unknown timestamping mode .\ n"); break ; } } switch ( transport ) { default : case ASI_CTL_TRANSPORT_DVB_ASI : /* Set the stuffing parameters */ if ( verbose && ! quiet ) { printf (" Setting % i K28 .5 character (s) between bytes ,\ n" , stuffing . ib ); printf (" and % i + 2 K28 .5 characters between packets .\ n" , stuffing . ip ); if ( cap & ASI_CAP_TX_FINETUNING ) { printf (" Adding a K28 .5 character to " "%i / %i packets .\ n " , stuffing . big_ip , stuffing . normal_ip + stuffing . big_ip ); if ( cap & ASI_CAP_TX_INTERLEAVING ) { if ( stuffing . il_normal && stuffing . il_big ) { int normal_mult , big_mult , mult ; normal_mult = stuffing . normal_ip / stuffing . il_normal ; big_mult = stuffing . big_ip / stuffing . il_big ; mult = ( normal_mult > big_mult ) ? big_mult : normal_mult ; printf ( " Interleaving %i x % i = %i "
128
Parrthma bþ. K¸dikec
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
} else {
} else {
}
}
" K28 .5 characters " " over %i x %i = %i packets .\ n" , mult , stuffing . il_big , mult * stuffing . il_big , mult , stuffing . il_normal + stuffing . il_big , mult * ( stuffing . il_normal + stuffing . il_big ) );
printf (" Interleaved bitrate finetuning " " not supported .\ n") ;
printf (" Bitrate finetuning not supported .\ n ");
} } if ( ioctl ( fd , ASI_IOC_TXSETSTUFFING , & stuffing ) < 0) { if (! quiet ) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to set the stuffing parameters " ); } close ( fd ) ; return -1; } /* Calculate the target interface bitrate */ if (( cap & ASI_CAP_TX_FINETUNING ) && ( stuffing . normal_ip != 0) && ( stuffing . big_ip != 0) ) { bitrate = 270000000 * 0.8 * packetsize / ( packetsize + ( packetsize - 1) * stuffing . ib + stuffing . ip + ( double ) stuffing . big_ip / ( stuffing . normal_ip + stuffing . big_ip ) + 2) ; } else { bitrate = 270000000 * 0.8 * ( double ) packetsize / ( packetsize + ( packetsize - 1) * stuffing . ib + stuffing . ip + 2) ; } break ; case ASI_CTL_TRANSPORT_SMPTE_310M : bitrate = 19392658.46; break ; } if ( verbose && ! quiet ) { printf ( " Target interface bitrate = %.0 f bps .\ n" , bitrate ) ; } bytes_per_sec = bitrate / 8; /* Allocate some memory */ if ( bufsize < BUFSIZ ) {
B.2.
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
SCRIPTS
AN'ALUSHS
bufsize = BUFSIZ ; } if ( verbose && ! quiet ) { printf (" Allocating % lu bytes of memory .\ n" , bufsize ); } if (( data = ( unsigned char *) malloc ( bufsize ) ) == NULL ) { if (! quiet ) { fprintf ( stderr , "%s: unable to allocate memory \n" , argv [0]) ; } close ( fd ) ; return -1; } /* Repeatedly send the data and estimate the throughput */ lasttime = 0; if (! quiet ) { if ( verbose ) { printf (" Transmitting from standard input ...\ n"); } if ( gettimeofday (& tv , NULL ) < 0) { fprintf ( stderr , "%s: " , argv [0]) ; perror (" unable to get time ") ; free ( data ); close ( fd ) ; return -1; } lasttime = tv . tv_sec + ( double ) tv . tv_usec / 1000000; } return 0; USAGE :
fprintf ( stderr , " Try '%s -h ' for more information .\ n" , argv [0]) ; return -1;
}
B.2
Scripts anlushc
B.2.1 bash Bþ.2.1.1
1 2 3 4 5 6 7 8 9 10 11 12
129
udp_ipv4
# !/ bin / bash CUR_PATH =` pwd `; DATA_PATH =" $CUR_PATH / data "; PERL_PATH =" $CUR_PATH / perl "; # echo $DATA_PATH ; # ls $DATA_PATH ; if [ -d $DATA_PATH ] then cd $DATA_PATH ;
130 13 14
echo -e "\n\ n________ Starting Analysis ! _________________________ \n ";
15 16 17 18 19 20 21 22 23
for i in $( ls ); do echo -e "\n\ t___ Entering directory : $i ___ " ; cd $i ; if [ -f rx ] && [ -f tx ] then echo ok ; echo -e "\n \t\ t___ Converting files with tcpdump . ___ \n" ; tcpdump - tt - vv -n -r tx > udp_sender . txt tcpdump - tt - vv -n -r rx > udp_receiver . txt # echo -e "\ n \t\ t___ Checking for duplicate packets . ___ \n "; # perl $PERL_PATH / ipv4_replicid . pl ; echo -e "\n \t\ t___ Running ipv4_createendfiles . pl ___ \n" ; perl $PERL_PATH / ipv4_createendfiles . pl ; echo -e "\n \t\ t___ Calculating losses . ___ \n "; perl $PERL_PATH / ipv_all_losses . pl ; echo -e "\n \t\ t___ Calculating data rate ___ \n"; perl $PERL_PATH / ipv_all_sender_receiver_rate . pl ; echo -e "\n \t\ t___ Alligning packets to calculate jitter ___ \n"; perl $PERL_PATH / ipv_all_align_for_delay_jitt . pl ; echo -e "\n \t\ t___ Creating time files . ___ \ n"; perl $PERL_PATH / ipv_all_timestamp . pl ; echo -e "\n \t\ t___ Calculating smoothed jitter . ___ \ n"; perl $PERL_PATH / ipv_all_inter_arrival_jitter . pl ; echo -e "\n \t\ t___ Calculating one - way delay . ___ \n" ; perl $PERL_PATH / ipv_all_one_way_delay . pl ; echo -e "\n \t\ t___ Calculating jitter . ___ \n "; perl $PERL_PATH / ipv_all_jitter . pl ; echo -e "\n \t\ t___ Creating losses plot . ___ "; gnuplot $PERL_PATH / losses . gpl ; echo -e "\n \t\ t___ Creating one - way delay plot . ___ " ; gnuplot $PERL_PATH / one_way . gpl ; echo -e "\n \t\ t___ Creating jitter plot . ___ "; gnuplot $PERL_PATH / jitter . gpl ; echo -e "\n \t\ t___ Creating smooth jitter plot . ___ " ; gnuplot $PERL_PATH / jitter_smooth . gpl ; echo -e "\n \t\ t___ Calculating averages . ___ "; $PERL_PATH / calc_mean > report ; else echo " WARNING : Cannot locate 'rx ' and / or 'tx ' files in directory $i !"; fi echo -e "\n \ t___ Leaving directory : $i ___ \n "; cd ..; done
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
Parrthma bþ. K¸dikec
else
echo -e "\n \ n________ Analysis finished ! _________________________ \n "; echo " ERROR : Cannot find 'data ' directory !";
B.2.
64
SCRIPTS
AN'ALUSHS
131
fi
B.2.2 perl B.2.2.1 ipv4_createendles.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
# # # # # # # # # # # # #
This program is free software ; you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License , or ( at your option ) any later version . This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for more details . You should have received a copy of the GNU General Public License along with this program ; if not , write to the Free Software Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA .
# !/ usr / bin / perl -w open ( INPUTFILE , " < udp_sender . txt ") || die (" cannot open udp_sender file 1\ n " ); unless ( open ( OUTFILE , " > final . tx ")) { die (" cannot open output file outfile \ n"); } $start = time ; my ( @rec_lines ) = < INPUTFILE >; foreach $rec_line ( @rec_lines ) { chomp ( $rec_line ) ; @line = split (/[\ t +]/ , $rec_line ); {
for ( $k =0; $k < @line ; $k ++) $id =0; if ( $line [ $k ] eq " cid ") { $id = $line [ $k +1]; last ; }
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " seq ") {
132 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
Parrthma bþ. K¸dikec
}
$id = $id .( $line [ $k +1]) ; last ;
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " ser ") {
}
$id = $id .( $line [ $k +1]) ; last ;
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " id " ) {
}
$id = $id .( $line [ $k +1]) ; last ;
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " length :" ) {
}
$size = $line [ $k +1]; last ;
}
$time = $line [0]; # $id = substr ( $id ,0 , length ( $id ) -1) ; $size = substr ( $size ,0 , length ( $size ) -1) ; # print (" $id $size \n ") ; print OUTFILE (" $id \ t$id \ t$time \ t$size \n") ; } close ( INPUTFILE ) ; close ( OUTPUTFILE ); # second file open ( INPUTFILE , " < udp_receiver . txt ") || die (" cannot open udp_receiver file 1\ n"); unless ( open ( OUTFILE , " > final . rx ")) { die ( " cannot open output file outfile \ n"); }
B.2.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
SCRIPTS
AN'ALUSHS
my ( @rec_lines ) = < INPUTFILE >; foreach $rec_line ( @rec_lines ) { chomp ( $rec_line ) ; @line = split (/[\ t +]/ , $rec_line ) ; for ( $k =0; $k < @line ; $k ++) { $id =0; if ( $line [ $k ] eq " cid ") { $id = $line [ $k +1]; last ; } } for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " seq ") {
}
$id = $id .( $line [ $k +1]) ; last ;
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " ser ") {
}
$id = $id .( $line [ $k +1]) ; last ;
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " id " ) {
}
$id = $id .( $line [ $k +1]) ; last ;
} for ( $k =0; $k < @line ; $k ++) { if ( $line [ $k ] eq " length :" ) {
}
$size = $line [ $k +1]; last ;
133
134 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
}
Parrthma bþ. K¸dikec
$time = $line [0]; # $id = substr ( $id ,0 , length ( $id ) -1) ; $size = substr ( $size ,0 , length ( $size ) -1) ;
print OUTFILE (" $id \ t$id \ t$time \ t$size \n") ; } $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n "; close ( INPUTFILE ) ; close ( OUTPUTFILE );
B.2.2.2 ipv_all_losses.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# This program is free software ; you can redistribute it and / or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation ; either version 2 of the License , or # ( at your option ) any later version . # # This program is distributed in the hope that it will be useful , # but WITHOUT ANY WARRANTY ; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the # GNU General Public License for more details . # # You should have received a copy of the GNU General Public License # along with this program ; if not , write to the Free Software # Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA . # Author irons # Mail irons@pasiphae . teiher . gr # This file calculates the losses in a udp transmission . # !/ usr / bin / perl -w $start = time ; & calc_loss ; $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n "; sub calc_loss # Simple loss calculation { my ( $sender_packets ); my ( $receiver_packets ) ; my ( $loss_rate );
B.2.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
SCRIPTS
AN'ALUSHS
135
$sender_packets = 0; $receiver_packets = 0; $loss_rate = 0; # Sender file open ( SENDER , " < final . tx ") || die (" cannot open input file 1\ n" );
while (< SENDER >) { $sender_packets ++; } close ( SENDER ); # Receiver file open ( RECEIVER , " < final . rx ") || die (" cannot open input file 2\ n"); while (< RECEIVER >) { $receiver_packets ++; } close ( RECEIVER ); # calculation $loss_rate = (( $sender_packets $receiver_packets ) / $sender_packets ) * 100; print " sender packets $sender_packets , receiver packets $receiver_packets , losses $loss_rate %\ n"; { }
if (( $sender_packets - $receiver_packets ) !=0) & lossvstime ;
} sub lossvstime { unless ( open ( OUTFILE , " > pack_num_seq_loss_vs_time ")) { die (" cannot open output file outfile \ n"); }
136 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
Parrthma bþ. K¸dikec
open ( SENDER , " < final . tx "); open ( RECEIVER , " < final . rx ") ; my ( @sen_lines ) = < SENDER >; my ( $sen_line ); my ( @rec_lines ) = < RECEIVER >; my ( $rec_line ); my ( $temp ); my ( $temp1 ); my ( $lock ); my ( $lock_ref_time ); my ( $send_time ); my ( $start_ref_time ); my ( $packet_counter ); close ( SENDER ); close ( RECEIVER ); $size = @rec_lines ; $size1 = @sen_lines ; $packet_counter =0; $lock_ref_time =0; foreach $sen_line ( @sen_lines ) { $lock =0; $packet_counter ++; chomp ( $sen_line ) ; @line_sender = split (/[\ t +]/ , $sen_line ); $temp1 = $line_sender [0]. $line_sender [1]; {
if ( $lock_ref_time ==0)
$start_ref_time = $line_sender [2]; $lock_ref_time =1; # print ("\ n$start_ref_time \n ") ; } foreach $rec_line ( @rec_lines ) { chomp ( $rec_line ) ; @line_receiver = split (/[\ t +]/ , $rec_line ); $temp = $line_receiver [0]. $line_receiver [1]; if ( $temp eq $temp1 ) { # unless ( open ( OUTFILE , ">> aligned_sender ") ) #{ #
die (" cannot open output file outfile \n ") ;
#}
# close ( OUTFILE ); $lock =1; last ; # print " sender $sen_line receiver $rec_line \n "; } } if ( $lock ==0) {
B.2.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
SCRIPTS
AN'ALUSHS
$send_time = $line_sender [2] - $start_ref_time ; print OUTFILE " $send_time \ t$packet_counter \n"; } # if ( $lock ==1) #{ # $send_time = $line_sender [2] - $start_ref_time ; # print OUTFILE " $send_time \ t0 \n "; #} } close ( OUTFILE ) ; & avg_lossvstime ; } sub avg_lossvstime { unless ( open ( OUTFILE , " > lossvstime ")) { die (" cannot open output file outfile \ n"); } open ( LOSSES , " < pack_num_seq_loss_vs_time "); my my my my my my my my my
( @sen_lines ) = < LOSSES >; ( $sen_line ); ( $temp1 ); ( $temp ); ( $lock ); ( $lock1 ); ( $send_time ); ( $packet_counter ); ( $line_counter );
close ( LOSSES ); $size = @rec_lines ; $size1 = @sen_lines ; $packet_counter =0; $lock_ref_time =0; $line_counter =0; $lock =0; $lock1 =0; foreach $sen_line ( @sen_lines ) { $packet_counter ++; chomp ( $sen_line ) ; @line_sender = split (/[\ t +]/ , $sen_line ); $temp = $line_sender [0]; if ( $lock ==0) { $temp1 = $line_sender [0]; # print " $temp1 \n "; @line_sender_last = split (/[\ t +]/ , $sen_lines [( @sen_lines ) -1]) ; # print " $line_sender_last [0]\ n "; # $packet_counter =0; $lock =1; }
137
138 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
Parrthma bþ. K¸dikec
if (( $temp1 +1.0) < ( $temp ) ) { if ( $lock1 ==0) { $pack_count = $packet_counter -1; print OUTFILE " $send_time \ t$pack_count \n" ; # print " $send_time \ t$packet_counter \ t$temp \n "; $packet_counter =1; $temp1 = $temp ; } } if (( $temp1 +1) > ( $line_sender_last [0]) ) { $lock1 =1; if ( $temp == $line_sender_last [0]) { $send_time = $temp ; # print " $send_time \ t$packet_counter \ t$temp \n "; print OUTFILE " $send_time \ t$packet_counter \n"; } } $send_time = $temp ; $line_counter ++; } close ( OUTFILE ) ; # print " $pack_count \ t$packet_counter \ t$line_counter \n "; }
B.2.2.3 ipv_all_sender_receiver_rate.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
# # # # # # # # # # # # #
This program is free software ; you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License , or ( at your option ) any later version . This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for more details . You should have received a copy of the GNU General Public License along with this program ; if not , write to the Free Software Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA .
# !/ usr / bin / perl -w my ( $sum_pack_size ) ; my ( $lock ); my ( $start_time ); my ( $end_time ); my ( $transffer_time ); my ( $data_rate ); $data_rate =0; $transffer_time =0; $sum_pack_size =0;
B.2.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
SCRIPTS
AN'ALUSHS
139
$lock =0; $start_time =0; $end_time =0; open ( SENDER , " < final . tx ") || die (" cannot open input file 1\ n"); $start = time ; while (< SENDER >) { my ( $sen_line ) = $_ ; chomp ( $sen_line ) ;
{ }
@line_sender = split (/[\ t +]/ , $sen_line ); $sum_pack_size += $line_sender [3]; if ( $lock ==0) $start_time = $line_sender [2]; $lock =1;
# print " $papa [3]\ n "; } $end_time = $line_sender [2]; # print " stime $start_time etime $end_time \n "; $transffer_time = $end_time - $start_time ; $data_rate = $sum_pack_size / $transffer_time ; print " SENDER RESULTS \n"; print " total bytes transferred $sum_pack_size in $transffer_time sec . Sender output data rate is $data_rate bytes / sec \n"; close ( SENDER ); open ( RECEIVER , " < final . rx ") || die (" cannot open input file 2\ n" ); $data_rate =0; $transffer_time =0; $sum_pack_size =0; $lock =0; $start_time =0; $end_time =0; while (< RECEIVER >) { my ( $sen_line ) = $_ ; chomp ( $sen_line ) ;
{ }
@line_receiver = split (/[\ t +]/ , $sen_line ); $sum_pack_size += $line_receiver [3]; if ( $lock ==0) $start_time = $line_receiver [2]; $lock =1;
# print " $papa [3]\ n "; } $end_time = $line_receiver [2]; print " stime $start_time etime $end_time \n "; $transffer_time = $end_time - $start_time ;
140 88 89 90 91 92 93 94 95 96 97 98 99
Parrthma bþ. K¸dikec
$data_rate = $sum_pack_size / $transffer_time ; print " RECEIVER RESULTS \n" ; print " total bytes transferred $sum_pack_size in $transffer_time sec . Receiver input data rate is $data_rate bytes / sec \n"; close ( RECEIVER ); $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n ";
B.2.2.4 ipv_all_align_for_delay_jitt.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# # # # # # # # # # # # #
This program is free software ; you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License , or ( at your option ) any later version . This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for more details . You should have received a copy of the GNU General Public License along with this program ; if not , write to the Free Software Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA .
# !/ usr / bin / perl -w unless ( open ( OUTFILE , " > aligned_sender ")) { die (" cannot open output file outfile \ n"); }
open ( SENDER , " < final . tx "); open ( RECEIVER , " < final . rx ") ; my ( @sen_lines ) = < SENDER >; my ( $sen_line ); my ( @rec_lines ) = < RECEIVER >; my ( $rec_line ); my ( $temp ); my ( $temp1 ); close ( SENDER ); close ( RECEIVER ); $size = @rec_lines ; $size1 = @sen_lines ; print " Receiver packets $size --- Sender packets $size1 \n"; $start = time ;
B.2.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
SCRIPTS
141
AN'ALUSHS
foreach $rec_line ( @rec_lines ) { chomp ( $rec_line ) ; @line_receiver = split (/[\ t +]/ , $rec_line ); $temp = $line_receiver [0]. $line_receiver [1]; foreach $sen_line ( @sen_lines ) { chomp ( $sen_line ) ; @line_sender = split (/[\ t +]/ , $sen_line ); $temp1 = $line_sender [0]. $line_sender [1]; if ( $temp eq $temp1 ) { # unless ( open ( OUTFILE , ">> aligned_sender ") ) #{ #
die (" cannot open output file outfile \n ") ;
#} print OUTFILE " $sen_line \ n"; # close ( OUTFILE ); last ; # print " sender $sen_line receiver $rec_line \n "; } } } $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n "; close ( OUTFILE ) ;
B.2.2.5 ipv_all_timestamp.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# !/ usr / bin / perl -w unless ( open ( SENDER , " < aligned_sender ")) { die (" cannot open input file outfile \n "); } unless ( open ( OUTFILE , " > sender_timestamp ") ) { die ( " cannot open output file outfile \ n"); }
142 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
Parrthma bþ. K¸dikec
$start = time ; while (< SENDER >) { my ( $sen_line ) = $_ ; chomp ( $sen_line ) ; @line_sender = split (/[\ t +]/ , $sen_line ); print OUTFILE " $line_sender [2]\ n";
# print " $papa [3]\ n "; } close ( OUTFILE ); close ( SENDER ); unless ( open ( RECEIVER , " < final . rx ")) { die ( " cannot open input file outfile \n "); } unless ( open ( OUTFILE , " > receiver_timestamp " )) { die ( " cannot open output file outfile \ n"); } while (< RECEIVER >) { my ( $sen_line ) = $_ ; chomp ( $sen_line ) ; @line_receiver = split (/[\ t +]/ , $sen_line ); print OUTFILE " $line_receiver [2]\ n";
# print " $papa [3]\ n "; } close ( OUTFILE ); close ( RECEIVER ); $elapsed_sec = time - $start ;
B.2.
80 81 82 83 84
SCRIPTS
143
AN'ALUSHS
my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n ";
B.2.2.6 ipv_all_inter_arrival_jitter.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
# # # # # # # # # # # # #
This program is free software ; you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License , or ( at your option ) any later version . This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for more details . You should have received a copy of the GNU General Public License along with this program ; if not , write to the Free Software Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA .
# !/ usr / bin / perl -w unless ( open ( SENDER , " < sender_timestamp ")) { die (" cannot open input file outfile \n "); } unless ( open ( RECEIVER , " < receiver_timestamp ")) { die (" cannot open input file outfile \n "); } my ( @sen_lines ) = < SENDER >; my ( $sen_line ); my ( @rec_lines ) = < RECEIVER >; my ( $rec_line ); my ( $transit ) ; my ( $delta_transit ) ; my ( $last_transit ); my ( $jitter ); my ( $counter ) ; $counter =0; $transit =0; $delta_transit =0; $last_transit =0; $jitter =0; close ( SENDER ); close ( RECEIVER ); unless ( open ( OUTFILE , " > final_jitter " )) { die ( " cannot open output file outfile \ n");
144 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
Parrthma bþ. K¸dikec
} unless ( open ( OUTFILE1 , " > final_pack2packdelay ")) { die ( " cannot open output file outfile \ n"); } $start = time ; foreach $sen_line ( @sen_lines ) { chomp ( $sen_line ); $transit = $rec_lines [ $counter ]- $sen_line ; if ( $last_transit !=0) { $delta_transit = $transit - $last_transit ; if ( $delta_transit < 0 ) { $delta_transit = - $delta_transit ; } $jitter +=( $delta_transit - $jitter ) /16.0; } $last_transit = $transit ; $result = $jitter *1000; $timerec = $rec_lines [ $counter ]; chomp ( $timerec ); print OUTFILE " $timerec $result \n"; $pack_delay = $delta_transit *1000; print OUTFILE1 " $timerec $pack_delay \n"; # print " $sen_line $rec_lines [ $counter ] $result \n "; $counter ++; } close ( OUTFILE ); close ( OUTFILE1 ); unless ( open ( INFILE , " < final_jitter ")) { die ( " cannot open input file outfile \n "); } $min =100000; $max =0; $counter =0; $result =0; $lock =0; while (< INFILE >) { my ( $sen_line ) = $_ ; chomp ( $sen_line ) ; @values = split (/[\ t +]/ , $sen_line );
B.2.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
SCRIPTS
AN'ALUSHS
$value = $values [1]; $result += $value ; if ( $counter ==1) { $min = $value ; } if ( $value > $max ) { $max = $value ; } if (( $value < $min ) ) { $min = $value ; } $counter ++; } close ( INFILE ); $result = $result / $counter ; print " aver jitter is $result max is $max min $min \n" ; unless ( open ( INFILE , " < final_pack2packdelay ")) { die (" cannot open input file outfile \n "); } $min =100000; $max =0; $counter =0; $result =0; $lock =0; while (< INFILE >) { my ( $sen_line ) = $_ ; chomp ( $sen_line ) ; @values = split (/[\ t +]/ , $sen_line ); $value = $values [1]; $result += $value ; if ( $counter ==1) { $min = $value ; } if ( $value > $max ) { $max = $value ; } if (( $value < $min ) ) {
145
146 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
Parrthma bþ. K¸dikec
$min = $value ; } $counter ++; } close ( INFILE ); $result = $result /( $counter ); print " aver pack2packdelay is $result max is $max min $min \ n";
unless ( open ( INFILE , " < final_pack2packdelay ")) { die ( " cannot open input file outfile \n "); } unless ( open ( OUTFILE , " > timed_final_pack2packdelay ")) { die ( " cannot open input file outfile \n "); } my ( @times ) = < INFILE >; close ( INFILE ); $time =0; $lock =0; for ( $i =0; $i < @times -1; $i ++) { {
if ( $lock ==0)
@valuesplits = split (/[\ t +]/ , $times [ $i ]) ; $valuesplit = $valuesplits [1]; chomp ( $valuesplit ); print OUTFILE " $time $valuesplit \n"; $lock =1; } # chomp ( $sen_line ); @timesplit = split (/[\ t +]/ , $times [ $i +1]) ; $temp_time1 = $timesplit [0]; @timesplit = split (/[\ t +]/ , $times [ $i ]) ; $temp_time2 = $timesplit [0]; $time =( $temp_time1 - $temp_time2 )+ $time ; # $time = $timesplit [0]; @valuesplits = split (/[\ t +]/ , $times [ $i +1]) ; $valuesplit = $valuesplits [1]; chomp ( $valuesplit ); print OUTFILE " $time $valuesplit \n"; # print " $time \n "; } close ( OUTFILE );
B.2.
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
SCRIPTS
AN'ALUSHS
unless ( open ( INFILE , " < final_jitter ") ) { die (" cannot open input file outfile \n "); } unless ( open ( OUTFILE , " > timed_final_jitter ")) { die (" cannot open input file outfile \n "); } my ( @times ) = < INFILE >; close ( INFILE ); $time =0; $lock =0; for ( $i =0; $i < @times -1; $i ++) { {
if ( $lock ==0)
@valuesplits = split (/[\ t +]/ , $times [ $i ]) ; $valuesplit = $valuesplits [1]; chomp ( $valuesplit ); print OUTFILE " $time $valuesplit \n"; $lock =1; } # chomp ( $sen_line ); @timesplit = split (/[\ t +]/ , $times [ $i +1]) ; $temp_time1 = $timesplit [0]; @timesplit = split (/[\ t +]/ , $times [ $i ]) ; $temp_time2 = $timesplit [0]; $time =( $temp_time1 - $temp_time2 )+ $time ; # $time = $timesplit [0]; @valuesplits = split (/[\ t +]/ , $times [ $i +1]) ; $valuesplit = $valuesplits [1]; chomp ( $valuesplit ); print OUTFILE " $time $valuesplit \n"; # print " $time \n "; } close ( OUTFILE ); $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n ";
B.2.2.7 ipv_all_one_way_delay.pl 1 2 3 4
# # # #
This program is free software ; you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License , or ( at your option ) any later version .
147
148 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
# # # # # # # # #
Parrthma bþ. K¸dikec
This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for more details . You should have received a copy of the GNU General Public License along with this program ; if not , write to the Free Software Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA .
# !/ usr / bin / perl -w unless ( open ( SENDER , " < sender_timestamp ")) { die (" cannot open input file outfile \n "); } unless ( open ( RECEIVER , " < receiver_timestamp ")) { die ( " cannot open input file outfile \n "); } my ( @sen_lines ) = < SENDER >; my ( @rec_lines ) = < RECEIVER >; my ( $delay ); my ( $counter ) ; my ( $avg_delay ); my ( $sample_time ); my ( $min ); my ( $max ); $counter =0; $delay =0; $avg_delay =0; $sample_time =0; $max = -1; $min =1000000; close ( SENDER ); close ( RECEIVER ); unless ( open ( OUTFILE , " > one_way_delayvstime ")) { die ( " cannot open output file jittervstime \n "); } $start = time ; # One way delay formula is Di = abs ( R_i - S_i ) # Avg One way Delay is Sum ( Di )/n for ( $i =0; $i < @sen_lines ; $i ++) { # print (" Sender line $sen_lines [ $i ]\ n ") ; # print (" Receiver line $rec_lines [ $i ]\ n ") ;
B.2.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
{
SCRIPTS
AN'ALUSHS
149
$delay = abs (( $rec_lines [ $i ]) -( $sen_lines [ $i ]) ) *1000; $avg_delay += $delay ; if ( $min > $delay )
$min = $delay ; } if ( $max < $delay ) { $max = $delay ; } $sample_time = $rec_lines [ $i ]- $rec_lines [0]; # print (" $sample_time $jitter \n ") ; print OUTFILE " $sample_time $delay \n "; $counter ++; } $avg_delay =( $avg_delay / $counter ); print (" Average One way Delay is $avg_delay ms . Max One way Delay is $max ms . Min One way Delay is $min ms \n"); close ( OUTFILE ); $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60; my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n ";
B.2.2.8 ipv_all_jitter.pl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# # # # # # # # # # # # #
This program is free software ; you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License , or ( at your option ) any later version . This program is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for more details . You should have received a copy of the GNU General Public License along with this program ; if not , write to the Free Software Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 -1307 , USA .
# !/ usr / bin / perl -w unless ( open ( SENDER , " < sender_timestamp ")) { die (" cannot open input file outfile \n "); } unless ( open ( RECEIVER , " < receiver_timestamp ")) { die (" cannot open input file outfile \n "); } my ( @sen_lines ) = < SENDER >;
150 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
Parrthma bþ. K¸dikec
my ( @rec_lines ) = < RECEIVER >; my ( $jitter ); my ( $counter ) ; my ( $avg_jitter ); my ( $sample_time ); my ( $min ); my ( $max ); $counter =0; $jitter =0; $avg_jitter =0; $sample_time =0; $max = -1; $min =1000000; close ( SENDER ); close ( RECEIVER ); unless ( open ( OUTFILE , " > jittervstime " )) { die ( " cannot open output file jittervstime \n "); } $start = time ; # Jitter formula is Di = abs ( R_ (i) -R_ (i -1) ) -( S_ (i) -S_ (i -1) ) # Avg jitter is Sum ( Di ) /n for ( $i =0; $i < @sen_lines -1; $i ++) {
{
# print (" Sender line $sen_lines [ $i ]\ n ") ; # print (" Receiver line $rec_lines [ $i ]\ n ") ; $jitter = abs (( $rec_lines [ $i +1] - $rec_lines [ $i ]) -( $sen_lines [ $i +1] - $sen_lines [ $i ]) ) *1000; $avg_jitter += $jitter ; if ( $min > $jitter )
$min = $jitter ; } if ( $max < $jitter ) { $max = $jitter ; } $sample_time = $rec_lines [ $i +1] - $rec_lines [0]; # print (" $sample_time $jitter \n ") ; print OUTFILE " $sample_time $jitter \ n"; $counter ++; } $avg_jitter =( $avg_jitter / $counter ); print (" Average Jitter is $avg_jitter ms . Max jitter is $max ms . Min jitter is $min ms \n" ); close ( OUTFILE ); $elapsed_sec = time - $start ; my $second = $elapsed_sec %60; my $minute = ( $elapsed_sec /60) %60;
B.2.
90 91
SCRIPTS
151
AN'ALUSHS
my $hour = ( $elapsed_sec /(60*60) ) %24; print " Total Time elapsed : $hour hours : $minute min : $second sec \n ";
B.2.3
gnuplot
B.2.3.1 losses.gpl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
set set set set set set set set
title " Losses vs Time " xlabel " time ( sec )" ylabel " Lost Packets " format x " %.0 f" format y " %.0 f" yrange [0:*] xdata time nokey
set terminal postscript eps 22 set size 1 ,1; set term post landscape color " Times - Roman " 14 set output " losses . eps " plot " lossvstime " using ($1 -946684800.0) :2 with points pointtype 5 pointsize 1; # load " a2b_tput . labels "; # plot " lossvstime " using ($1 -946684800.0) :2 with points pointtype 5 pointsize 1; # set terminal png color ; # set output " losses . png " # replot # pause -1;
B.2.3.2 one_way.gpl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
set set set set set set set set set set set set
xlabel " Time ( sec )" ylabel " One Way Delay ( ms )" format x " %.0 f" format y " %.0 f" xdata ydata grid mxtics 6 mytics 6 autoscale nokey origin 0 ,0
set terminal postscript eps 22 set size 1 ,1; set term post landscape color " Times - Roman " 14 set output " one_way . eps " plot " one_way_delayvstime " with dots lt -1 ; # set xrange [0:180] # set size 0.75 , 0.75 # set size ratio 0 0.5 ,0.48 # plot " one_way_delayvstime " with dots
lt -1 ;
152 25 26 27 28 29
Parrthma bþ. K¸dikec
# set terminal png x255255255 ; # set terminal png tiny # set output " one_way . png " # replot # pause -1;
B.2.3.3 jitter.gpl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
set set set set
xlabel ylabel format format
" Time ( sec )" " Inter - arrival Jitter ( ms ) " x " %.0 f" y " %.0 f"
set set set set set set set set
xdata ydata grid mxtics 6 mytics 6 autoscale nokey origin 0 ,0
set terminal postscript eps 22 set size 1 ,1; set term post landscape color " Times - Roman " 14 set output " jitter . eps " plot " jittervstime " with line lt -1 lw -1 ;
B.2.3.4 jitter_smooth.gpl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
set set set set
xlabel ylabel format format
" Time ( sec )" " Inter - arrival Jitter ( ms ) " x " %.0 f" y " %.0 f"
set xdata set ydata set grid set mxtics 6 set mytics 6 set autoscale set nokey # set xrange [0:180] # set yrange [0:5] set origin 0 ,0 set terminal postscript eps 22 set size 1 ,1; set term post landscape color " Times - Roman " 14 set output " smooth_jitter . eps " plot " timed_final_jitter " with line lt -1 lw -1 ; # plot " timed_final_pack2packdelay " with dots lt -1 ; # plot " timed_final_jitter " with line lt -1 lw -1 ; # set terminal png x255255255 ; # set output " smooth_jitter . png " # show xtics # show ytics # replot
B.2.
31
SCRIPTS
# pause -1;
AN'ALUSHS
153