Preview only show first 10 pages with watermark. For full document please download

Montèlo Prosomoðwshc Thc Ule Enjulˆkwshc Anwtato Teqnologiko Ekpaideutiko Idruma Krhths

   EMBED


Share

Transcript

ANWTATO TEQNOLOGIKO EKPAIDEUTIKO IDRUMA KRHTHS Ptuqiak  ErgasÐa Montèlo prosomoÐwshc thc ULE enjulˆkwshc Spoudast c: Eishght c: Nikìlaoc Borniwtˆkhc Dr. Euˆggeloc Pˆllhc 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 perˆtwsh aut c thc ergasÐac. Ja  tan parˆleiyh na mhn anaferj¸ se ìlouc ekeÐnouc pou sumparastˆjhkan se aut n thn prospˆjeia. Katˆ kÔrio lìgo, ofeÐlw na euqarist sw ton epiblèpontˆ mou kajhght  apì to A.T.E.I Kr thc k. Pˆllh Euˆggelo gia thn, kaj'ìlh thn diˆrkeia 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 sunergˆtec tou ergasthrÐou Thlepikoinwni¸n kai DiktÔwn (PASIFAH) tou A.T.E.I. Kr thc k. Markˆkh Euˆggelo, k. Sidèrh Anˆrguro kaj¸c kai stouc upoy fiouc didˆktorec k. Mastorˆkh 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 qreiˆsthke, katˆferan 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 prospˆjeia parèqontac aperiìristh yuqologik  upost rixh kai katanìhsh. Hrˆkleio, Septèmbrioc 2007 Borniwtˆkhc Nikìlaoc Perieqìmena Perieqìmena 3 Katˆlogoc Sqhmˆtwn 7 Katˆlogoc Pinˆkwn 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 fˆsh polÔplexhc . . . . . . . . . . . . . . . . . 18 2.2.2 DeÔterh fˆsh 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 Stˆdia 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 metˆdosh . . . . . . . . . . . . . . . . 31 3 DVB-T . . . . . . . . . 27 4 Perieqìmena 3.2.5 4 5 6 Wfèlimo bit rate 3.3 Metˆdosh 3.4 Amfidromikìthta IP . . . . . . . . . . . . . . . . . . . . . . 33 dedomènwn pˆnw apì to kanˆli DVB-T . . . . . . 34 . . . . . . . . . . . . . . . . . . . . . . . . . 35 H mèjodoc enjulˆkwshc 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 kˆrta . . . . . . . . . . . . . . . . . 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 Enjulˆkwsh . . . . . . . . . . . . . . . . . . . . . . . . 54 6.3.4.1 Algìrijmoc enjulˆkwshc . . . . . . . . . . . 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 PERIEQŸOMENA 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 Senˆria 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 Egkatˆstash . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 8.1.1 Egkatˆstash odhg¸n kˆrtac . . . . . . . . . . . . . . . 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 apotelesmˆtwn . . . . . . . . . . . . . . . . . . . . 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 apotelesmˆtwn . . . . . . . . . . . . . . . . . . . . 80 10 Sumperˆsmata 81 Perieqìmena 6 BibliografÐa 83 Index 85 Aþ Diagrˆmmata 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 anˆlushc . . . . . . . . . . . . . . . . . . . . . . . . . 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 Katˆlogoc Sqhmˆtwn 2.1 Roèc bÐnteo,  qou kai dedomènwn sunduˆzontai 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 diˆgramma leitourgÐac enìc 4.3 To 6.1 H eÐsodoc diktÔou kai h 6.2 H kˆrta 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 Diˆgramma 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 parastˆseic 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 diˆgramma kajustèrhshc. . . . . . . . . . . . . . . . . . . . 77 7 Katˆlogoc Sqhmˆtwn 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 Katˆlogoc Pinˆkwn 4.1 To overhead pou apaiteÐtai gia orismèna eÐdh metadìsewn. . . . 41 9 10 Katˆlogoc Pinˆkwn Kefˆlaio 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 enjulˆkwshc 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 enjulˆkwshc pou èqoun protajeÐ (ULE). Gia ton skopì autì ja ulopoihjeÐ mÐa diktuak  efarmog  h opoÐa ja analˆbei thn epèktash enìc klassikoÔ ethernet diktÔou sta ìria thc perioq c kˆluyhc thc yhfiak c thleìrashc kˆnontac qr sh twn teqnik¸n thc 1.2 ULE enjulˆkwshc. Stìqoi Basikìc stìqoc thc ptuqiak c ergasÐac aut c eÐnai h anˆptuxh 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 Kefˆlaio 1. Eisagwg  12 1.3 Dom  Se mia prospˆjeia gia thn sfairik  kˆluyh twn arq¸n pou dièpoun èna tètoio sÔsthma èqoun eisaqjeÐ ta kefˆlaia 2, 3 kai 4. Sto kefˆlaio 2 gÐnetai h parousÐash tou protÔpou MPEG to opoÐo apoteleÐ shmantikì kommˆti thc èreunac afoÔ ìla ta dedomèna pou diakinoÔntai se èna kanˆli yhfiak c thleìrashc eÐnai sthn morf  MPEG2-TS surm¸n dedomènwn. Sto kefˆlaio 3 gÐnetai h parousÐash tou protÔpou DVB-T. Sto kefˆlaio 4 parousiˆzetai kai analÔetai h mèjodoc enjulˆkwshc ULE. Se aut n sthrÐzetai h melèth aut . Sto kefˆlaio 5 gÐnetai o sqediasmìc tou sust matoc kai analÔontai oi apait seic apì pleurˆc 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 kefˆlaio 6 analÔetai h diadikasÐa gia thn ulopoÐhsh twn epimèrouc stoiqeÐwn tou sust matoc. Sto kefˆlaio 7 perigrˆfetai h logik  kai h diadikasÐa twn metr sewn gia thn axiolìghsh tou diktÔou pou ulopoi jhke. Sto kefˆlaio 8 perigrˆfetai h diadikasÐa pou akolouj jhke gia na sthjeÐ to sÔsthma se èna Linux mhqˆnhma. Sto kefˆlaio 9 parousiˆzontai kai sqoliˆzontai ta apotelèsmata twn metr sewn. Sto kefˆlaio 10 analÔontai ta sumperˆsmata kai gÐnontai protˆseic gia mellontikèc belti¸seic. Kefˆlaio 2 To prìtupo MPEG Se autì to kefˆlaio ja parousiasteÐ to prwtokìllo MPEG. To prwtìkollo autì apoteleÐtai apì pollˆ xeqwristˆ kommˆtia kai kajorÐzei metaxÔ ˆllwn prìtupa sumpÐeshc eikìnac kai  qou, prìtupa polÔplexhc reumˆtwn 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 sfˆlmata metˆdoshc 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 omˆdac ergasÐac tou International Organization for Standardization (ISO) kai tou International Electrotechnical Commission (IEC), h opoÐa eÐnai epifor- tismènh me thn anˆptuxh protÔpwn kwdikopoÐhshc gia yhfiakì bÐnteo kai  qo. H omˆda 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  omˆda 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 omˆda èqei ekd¸sei 6 prìtupa: 13 14 Kefˆlaio 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 omˆdac kai aforˆ thn anˆptuxh 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 parousiˆzei èna prìtupo, to Program Stream(PS), to opoÐo epitrèpei to sugqronismì kai thn polÔ- plexh reumˆtwn  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 kˆje frame tou video. Sto trÐto mèroc tou prwtokìllou perigrˆfetai 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 kˆpoiec parathr seic thc epist mhc thc yuqoakoustik c. Sto tètarto mèroc tou prwtokìllou perigrˆfontai kˆpoiec 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 parousiˆzetai è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, kˆpoia mèrh tou qrhsimopoioÔntai se megˆlo 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 megˆlo 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 kefˆlaia. Sto pr¸to mèroc tou, to prwtìkollo MPEG-2 parousiˆzei èna nèo prìtupo polÔplexhc kai paketopoÐhshc twn diafìrwn reumˆtwn enìc mèsou. To prìtupo autì onomˆzetai 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¸ parˆllhla epekteÐnetai to upˆrqon prìtupo Program Stream (PS) epitrèpontac thn apotelesmatikìterh apoj keush reumˆtwn. Sto deÔtero kefˆlaio tou MPEG2 pou aforˆ ta prìtupa sumpÐeshc bÐnteo, to prwtìkollo kajorÐzei mia proèktash tou upˆrqontoc 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  omˆda parousÐase kˆpoia nèa kefˆlaia sto prwtìkollo. Sto èkto kai dèkato kefˆlaio parousiˆzetai to prwtìkollo (Digital Storage Media Command and Control), DSM-CC to opoÐo epitrèpei th dhmiourgÐa sunedri¸n metaxÔ enìc pelˆth kai enìc exuphretht  mèswn, kaj¸c kai ton apomakrusmèno èlegqo twn exuphretht¸n. Sto èbdomo kefˆlaio parousiˆsthke èna nèo prìtupo kwdikopoÐhshc  qou, to ACC, to opoÐo epitrèpei thn kwdikopoÐhsh polukˆnalwn reumˆtwn  qou. Tèloc, sto ìgdoo kefˆlaio 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 kefˆlaio parousiˆzei mia diepaf  anˆmesa sto Trans- port Stream kai ston apokwdikopoiht , pou stìqo èqei na kalÔyei tic anˆgkec tou DSM-CC 3. MPEG-4: MPEG-4. gia th dhmiourgÐa sunedri¸n. H trÐth èkdosh prwtokìllou apì thn omˆda MPEG  tan to To prwtìkollo autì èqei sunolikˆ 21 kefˆlaia, diathr¸n- tac bèbaia touc tÐtlouc twn 6 pr¸twn Ðdiouc me autoÔc touc MPEG-2. To prwtìkollo autì parousiˆsthke 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 upˆrqonta prwtìkolla. Merikèc apì tic epektˆseic pou uposthrÐzontai eÐnai h dunatìthta diaqeÐrishc pollapl¸n reumˆtwn  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 dikaiwmˆtwn, pou prokÔptoun apì memonwmèna antikeÐmena enìc arqeÐou. Tèloc, to prwtìkollo parousÐase kai kˆpoiouc neìterouc kai apodotikìterouc algorÐjmouc Kefˆlaio 2. To prìtupo 16 sumpÐeshc  qou kai bÐnteo (AVC). To MPEG-4 rujmoÔc metˆdoshc 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 omˆda. H melèth tou xekÐnhse ton AprÐlio tou 1997 kai akìma brÐsketai upì anˆptuxh. ApoteleÐtai sunolikˆ apì 11 kefˆlaia. To MPEG-7 kajorÐzei kˆpoiec 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 perigrˆfoun ta dedomèna tou arqeÐou. Ta dedomèna autˆ upakoÔn se kˆpoio 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 omˆdac gia to mèllon ston tomèa twn polumèswn. H anˆptuxh tou xekÐnhse to Mˆio – IoÔnio tou 2000. To MPEG-21 eÐnai èna anoiqtì prwtìkollo pou stìqo èqei thn anˆptuxh enìc plaisÐou gia ton èlegqo twn dikaiwmˆtwn se efarmogèc polumèswn. Poio sugkekrimèna to prwtìkollo kajorÐzei èna prìtupo gia mia “Gl¸ssa èkfrashc dikaiwmˆtwn”(Rights Expression Language) me thn opoÐa mporeÐ na emploutÐzetai kˆje arqeÐo polumèswn kai h opoÐa kajorÐzei thn ˆdeia, ta dikai¸mata kai touc periorismoÔc pou epibˆlei o dhmiourgìc tou perieqomènou stouc qr stec. Se genikèc grammèc to MPEG-21 prospajeÐ na eisˆgei tic ènnoiec thc dhmiourgÐac, prìsbashc, thc antallag c kai diaqeÐrishc hlektronik¸n dikaiwmˆtwn sto shmerinì plaÐsio anˆptuxhc polumèswn me trìpo o opoÐoc na mh gÐnetai antilhptìc ˆmesa apì touc qr stec. H anˆptuxh tou protÔpou autoÔ èqei wc kÔrio stìqo th katapolèmhsh thc peirateÐac h opoÐa anaptÔssetai se megˆlo bajmì apì ta dÐktua Peer to Peer. To prwtìkollo autì brÐsketai akìma upì anˆptuxh kai stoqeÔei na allˆxei katˆ polÔ ton trìpo pou antilambanìmaste tic efarmogèc polumèswn. H omˆda anˆptuxhc tou MPEG apoteleÐtai tìso apì akadhmaðkoÔc egnws- mènhc axÐac ìso kai apì ekpros¸pouc thc biomhqanÐac. H anˆptuxh twn prwtokìllwn gÐnetai mèsa apì anoiqtèc proskl seic gia protˆseic, oi opoÐec gÐnontai mìno proc ta mèlh thc omˆdac. Me bˆsh tic protˆseic, pou gÐnontai, oi MPEG-2 2.2. 17 omˆdec pou èqoun analˆbei thn anˆptuxh kˆpoiou protÔpou proteÐnoun kˆpoio arqikì keÐmeno to opoÐo mèsa apì suzht seic kai yhfoforÐec katal gei sthn telik  dhmosÐeush. H anˆptuxh 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, anagkˆzontac touc endiaferìmenouc na katabˆloun kˆpoio posì ston ISO gia na lˆboun antÐgrafa twn protÔpwn. 2.2 To MPEG-2 MPEG–2 ìpwc eÐdame kai parapˆnw kajorÐzei èna prìtupo gia thn polÔ- plexh enìc   perissotèrwn stoiqeiwd¸n reumˆtwn  qou kai bÐnteo, kaj¸c kai ˆllwn dedomènwn, miac parousÐashc se èna   perissìtera reÔmata katˆllhla gia apoj keush   metˆdosh [4]. Oi leptomèreiec gia ton trìpo leitourgÐac thc polÔplexhc tou MPEG–2 kajorÐzontai sto pr¸to kefˆlaio 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 reumˆtwn 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 parˆdeima, h sumpÐesh tou reÔmatoc bÐnteo mporeÐ na gÐnei me bˆsh 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ì metˆdoshc, 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 sunduˆzontai gia na sqhmatÐsoun surmoÔc PS kai TS. Kefˆlaio 2. To prìtupo 18 MPEG H diadikasÐa polÔplexhc twn epÐ mèrouc reumˆtwn akoloujeÐ mia strwmatik  prosèggish dÔo epipèdwn kai parousiˆzetai diagrammatikˆ sthn eikìna 2.1. 2.2.1 Pr¸th fˆsh polÔplexhc Sthn pr¸th fˆsh thc diadikasÐac polÔplexhc tou MPEG–2, to sÔsthma parˆgei èna reÔma pakètwn pou onomˆzetai suskeuasmèno stoiqei¸dec reÔma (Packetized Elementary Stream) ementary Stream). gia kˆje 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 kˆpoiou 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 monˆdec prìsbashc (access units). MÐa monˆda prìsbashc anaparistˆ mÐa jemeli¸dh monˆda kwdikopoÐhshc. Kˆti 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 kˆpoia kommˆti dedomènhc diˆrkeiac. Kˆje 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 metˆdosh   apoj keush enìc mèsou. To kˆje 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 toulˆqiston. H dom  enìc KB, PES en¸ perilambˆnei 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 fˆsh polÔplexhc Sth deÔterh fˆsh thc diadikasÐac polÔplexhc ta pakèta se èna   perissìtera reÔmata progrˆmmatoc (Program ma metaforˆc (Transport Stream). PES sunduˆzontai Stream)   se èna reÔ- Ta dÔo autˆ reÔmata anaptÔqjhkan gia na kalÔyoun antÐstoiqa tic anˆgkec dÔo megˆlwn omˆdwn gnwst¸n   anaptussìmenwn efarmog¸n. 'Etsi enswmat¸noun èna megˆlo bajmì euelixÐac en¸ tautìqrona epibebai¸noun ìti upˆrqei dialeitourgikìthta anˆmesa se diˆforec ulopoi seic suskeu¸n. 2.2.2.1 Program Stream To reÔma progrˆmmatoc (Program Stream) tou MPEG-2 eÐnai anˆlogo tou str¸matoc sust matoc (system layer) tou MPEG–1. To apotèlesmˆ tou eÐnai o sunduasmìc enìc   perissotèrwn reumˆtwn 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 peribˆllonta sqetikˆ me polÔ mikr  pijanìthta sfˆlmatoc kai eÐnai katˆllhlo 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 progrˆmmatoc eÐnai metablhtoÔ megèjouc. Se autˆ sun jwc perilambˆnontai 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 progrˆmmatoc 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 progrˆmmatoc emfanÐzetai kai sthn eikìna 2.2. Blèpoume ìti kˆje pakèto apoteleÐtai apì mÐa epikefalÐda kai diˆfora 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 metˆdoshc (Transport Stream) sunduˆzei èna h perissìtera epÐ mèrouc reÔmata dedomènwn pou basÐzontai se èna   perissìterouc metrhtèc Kefˆlaio 2. To prìtupo 20 MPEG qrìnou se èna kai monadikì reÔma. To reÔma metˆdoshc sqediˆsthke gia qr sh se peribˆllonta me megˆlh pijanìthta lˆjouc, ìpwc apoj keush   metˆdosh se peribˆllonta me jìrubo. Genikˆ to reÔma metaforˆc 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 metˆdoshc sqediˆsthke gia na mporeÐ mia efarmog  na ekteleÐ eÔkola kˆpoiec leitourgÐec. Kˆpoiec apì autèc tic leitourgÐec eÐnai: ˆ Anˆkthsh enìc mìno sugkekrimènou sumpiesmènou reÔmatoc dedomènwn, apì ta reÔmata pou perilambˆnei to reÔma metaforˆc. ˆ Exagwg  enìc mìno sugkekrimènou sumpiesmènou reÔmatoc dedomènwn, apì ta reÔmata pou perilambˆnei to reÔma metaforˆc, kai dhmiourgÐa nèou reÔmatoc pou ja perilambˆnei mìno to reÔma autì. ˆ DhmiourgÐa enìc reÔmatoc metˆdoshc apì reÔmata progrˆmmatoc gia th metˆdosh twn plhrofori¸n se kˆpoio peribˆllon me sfˆlmata kai dhmiourgÐa metˆ apì to reÔma metˆdoshc twn arqik¸n reumˆtwn progrˆmmatoc. 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 kˆje è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 pˆnta 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 anˆloga eˆn to pakèto perièqei lˆjh   ìqi. To pedÐo paÐrnei tim  katˆ thn diˆrkeia thc l yhc twn dedomènwn ¸ste na gÐnetai gnwstì ìti èqei prokÔyei sfˆlma katˆ thn metˆdosh. 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 enjulˆkwshc, aut  h shmaÐa èqei ˆllh antimet¸pish pou ja perigrafeÐ parakˆtw. Transport Priority Autì to pedÐo eÐnai mÐa shmaÐa enìc : kai lambˆnei 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ˆ progrˆmmata, ìpwc eÐnai dunat  kai h metaforˆ enìc progrˆmmatoc apì ton èna surmì ston ˆllo. Transport Scrambling Control : Autì to pedÐo èqei mègejoc 2 anafèrei eˆn 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 kratˆei to pedÐo adaptation, bit Mia apì tic eÐnai to PCR (Program Clock Reference) bˆsei tou opoÐou sugqronÐzontai oi diˆforec 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 auxˆnetai se kˆje epìmeno pakèto. Autìc eÐnai qr simoc 2 Στις τηλεπικοινωνίες είναι σύνηθες, πριν μεταδοθεί μία ροή δεδομένων, να εφαρμόζονται σε αυτήν αλγόριθμοι scrambling ώστε να αλλάξει η σειρά των δεδομένων. Αυτή η τεχνική δεν έχει να κάνει με κρυπτογράφηση, αφού ο σκοπός δεν είναι να καταστήσει τα δεδομένα μη προσβάσιμα, αλλά να τους προσδώσει χρήσιμες τεχνικές ιδιότητες. Αυτό επιτυγχάνεται αντικαθιστώντας ανεπιθύμητες αλληλουχίες (πολλοί άσσοι, πολλά μηδενικά, περιοδικές αλληλουχίες. . . ) με άλλες ΄καλύτερης΄ συμπεριφοράς. Kefˆlaio 2. To prìtupo 22 MPEG gia thn anÐqneush sfalmˆtwn metˆdoshc sthn seirˆ twn pakètwn. To reÔma progrˆmmatoc kai to reÔma metˆdoshc è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 kˆpoio ˆllo kaj¸c to èna reÔma den eÐnai uposÔnolo tou ˆllou. Gia th metatrop  twn reumˆtwn 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 progrˆmmatoc den eÐnai dunatìn na apokthjoÔn ˆmesa apì tic plhroforÐec twn epikefalÐdwn twn pakètwn reÔmatoc metˆdoshc, allˆ mporoÔn na dhmiourghjoÔn apì kˆpoia peraitèrw epexergasÐa twn pakètwn. Sq ma 2.3: H dom  enìc Sto pr¸to kefˆlaio tou prwtokìllou TS pakètou. MPEG-2 idiaÐterh mneÐa gÐnetai kai gia ton sugqronismì twn diafìrwn reumˆtwn. H leitourgÐa aut  eÐnai arketˆ shmantik  afenìc gia th swst  anaparagwg  twn parousiˆsewn, allˆ 2.2. MPEG-2 23 parˆllhla h efarmog  mac qrhsimopoieÐ tic plhroforÐec qronismoÔ pou metadÐdontai gia ton upologismì twn qronik¸n stigm¸n katˆ tic opoÐec oi pelˆtec ja prèpei na na zht soun to epìmeno kleidÐ kruptogrˆfhshc. Gia to sugqronismì twn epimèrouc reumˆtwn kˆje ulopoÐhsh tou prwtokìllou jètei kˆpoia mègista kat¸flia gia th metˆdosh kai anˆkthsh pakètwn, tìso tou reÔmatoc tou progrˆmmatoc, ìso kai tou reÔmatoc metaforˆc. 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 metˆdosh   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 kˆje tÔpou pakètou ja prèpei perilambˆnontai 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 onomˆzetai Rolìi Sust matoc (System Time Clock). kˆje pakèto PES Time Stamps). Me bˆsh autì to rolìi to prwtìkollo eisˆgei 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 bˆsei èna rolìi palm¸n 90 kHz. 'Opwc eÐdame kai parapˆnw to prwtìkollo anaptÔssei peraitèrw ta ìria metˆdoshc dedomènwn eisˆgontac kˆpoia extra pedÐa sta pakèta twn reumˆtwn, ta opoÐa kajorÐzoun epakrib¸c touc qrìnouc pou ja prèpei na ftˆsoun ta dedomèna sto kˆje epÐpedo tou prwtokìllou. 'Etsi loipìn èqoume to pedÐo anaforˆc RologioÔ progrˆmmatoc (Program Clock Reference) kai to proairetikì pedÐo Anaforˆc RologioÔ Stoiqei¸douc ReÔmatoc (Elementary Stream Clock Reference) gia to reÔma progrˆmmatoc kai to pedÐo Anaforˆc RologioÔ Sust matoc (System Reference) Clock gia to reÔma metaforˆc. Ta pedÐa autˆ kajorÐzoun to mègisto epitreptì qrìno pou mporeÐ na kˆnei to pakèto mèqri thn eÐsodì tou ston apokwdikopoiht . 24 Kefˆlaio 2. To prìtupo MPEG Kefˆlaio 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 pˆnw ston tomèa thc yhfiak c thleìrashc. Parˆllhla oriojeteÐtai to 1991 h dhmiourgÐa mÐac Eurwpaðk c omˆdac anˆptuxhc, h opoÐa ja katal xei to 1992, sthn dhmiourgÐa enìc protÔpou to opoÐo ja apotelèsei th bˆsh gia thn anˆptuxh 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 metˆdoshc. Uiojet¸ntac thn kwdikopoÐhsh katˆ MPEG-2 se ìla ta prìtupa, èqei epiteuqjeÐ h yhfiopoÐhsh programmˆtwn 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  metˆdosh, to to opoÐo uposthrÐzei thn kalwdiak  metˆdosh, to DVB-T to opoÐo anafèretai sthn amfÐdromh epÐgeia metˆdosh 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  metˆdosh. 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- sqediˆsthke gia na ekmetalleÔetai pl rwc to 25 Kefˆlaio 3. To prìtupo 26 DVB eÔroc z¸nhc twn doruforik¸n thleoptik¸n anametadot¸n. QrhsimopoieÐ rujmì metaforˆc 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ì kanˆli twn 8 MHz mporeÐ na metafèrei 38.5Mbps. Enallaktikˆ, mporeÐ na qrhsimopoihjeÐ QAM ligìterwn   perissìterwn epipèdwn. Se kˆje perÐptwsh, upˆrqei mÐa antistˆjmish metaxÔ taqÔthtac kai axiopistÐac. To epÐgeio sÔsthma DVB-T apoteleÐ to teleutaÐo qronikˆ mèloc thc oikogèneiac DVB. Epitugqˆnei yhfiak  metˆdosh uyhl¸n taqut twn pˆnw apì to dÔskolo epÐgeio kanˆli, 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 megˆlo arijmì ferìntwn (6817   1704 gia metˆdosh 8K kai 2K antÐstoiqa), kˆje èna apì ta opoÐa diamorf¸netai katˆ   64QAM. QPSK, 16QAM 'Etsi, h plhroforÐa katanèmetai omoiìmorfa sto fˆsma kai se sunduasmì me kwdikopoÐhsh kai diemplok  dÔo strwmˆtwn, to s ma apoktˆ megˆlh eurwstÐa akìmh kai se peribˆllonta me isqurèc dial yeic kai fainìmena poludiadromik c metˆdoshc (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, anˆgkh 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 asurmˆtwn 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  metˆdosh, 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 amerikˆnikou protÔpou ATSC, to opoÐo kai anaptÔqjhke stic Hnwmènec PoliteÐec, wc proc kˆpoia 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 metˆdosh dedomènwn IP en¸ to Iapwnikì DVB-T. eÐnai poluˆrijmec. Shmantikì pleonèkthma tou epÐgeiou sust matoc eÐnai ìti den apaiteÐ idiaÐtero exoplismì apì pleurˆc 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 anˆgkh doruforik c metˆdoshc   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 kˆluyhc 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 kˆluyhc (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 perigrˆfetai 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ì metaforˆc 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 parˆgei to Kefˆlaio 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 kanˆlia 21-69 thc mpˆntac twn UHF, ìpwc akrib¸c èna analogikì thleoptikì kanˆli. O diamorfwt c DVB-T qrhsimopoieÐ sq ma OFDM gia na antimetwpÐsei sth metˆdosh 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 mˆlista 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 shmˆtwn touc na ephreˆzei shmantikˆ to dèkth. Tètoia dÐktua onomˆzontai Single Frequency Networks (SFN) kai m- poroÔn na aux soun thn sunolik  qwrhtikìthta tou diktÔou se olìklhrh thn gewgrafik  epikrˆteia mèqri kai 45 forèc. Kaj¸c exaleÐfetai h anˆgkh na upˆrqoun eleÔjera kanˆlia se orismènec perioqèc, apofeÔgontai parembolèc me geitonikoÔc pompoÔc. To prìtupo DVB-T sunduˆzei to OFDM me sÔnjetec teqnikèc isostˆjmishc kai kwdikopoÐhshc, eisˆgontac thn teqnologÐa tou kwdikopoihmènou (Coded OFDM- COFDM). OFDM Sunduˆzontac kwdikopoÐhsh kai diemplok  dÔo epipèdwn, h diadikasÐa diamìrfwshc kajistˆ to s ma idiaÐtera anjektikì se poludiadromik  diˆdosh 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 stˆdiˆ thc xeqwristˆ. Oi leitourgÐec autèc, me th seirˆ pou efarmìzontai sto ReÔma Metaforˆc, 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 diˆtrhto 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 eisagˆgoume mÐa prìsjeth monˆda gia ˆnw metatrop . Sthn perÐptwsh thc ierarqik c diamìrfwshc, to s ma basik c z¸nhc proôpˆrqei diairemèno se dÔo ReÔmata Metaforˆc: è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 lambˆnei mìno ta dedomèna uyhl c proteraiìthtac, en¸ ènac me kalÔterec lambˆnei 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 metˆdoshc twn uphresi¸n, perigrˆfontai parakˆtw ta b mata pou akoloujeÐ aut  h yhfiak  metˆdosh. Gia thn kwdikopoÐhsh twn thleoptik¸n allˆ kai twn hqhtik¸n shmˆtwn kaj¸c kai gia thn poluplexÐa qrhsimopoieÐtai to krÐneia kai ˆristoc  qoc. 'Enac surmìc metaforˆc MPEG-2. MPEG-2, Apìluth eu- mporeÐ praktikˆ na metafèrei otid pote eÐnai dunatì na yhfiopoihjeÐ. 3.2 Stˆdia 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 Kˆje pakèto xekinˆ me to byte sugqronismoÔ, pou eÐnai pˆnta Ðso me 0x47. Prokeimènou na perioristeÐ to endeqìmeno na upˆrqoun megˆla Kefˆlaio 3. To prìtupo 30 DVB diast mata qwrÐc duadik  metabol  (makrièc akoloujÐec 0   1 - kˆti 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 parakˆtw 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 diˆrkeia thc exwterik c k- wdikopoÐhshc gÐnetai qr sh miac teqnik c pou onomˆzetai Emprìsjia ∆iìrjwsh Sfalmˆtwn, FEC (Forward Error Correction). SÔmfwna me thn teqnik  aut , se kˆje pakèto metaforˆc twn 188 bytes, prostÐjentai 16 bytes pleonasmoÔ, opìte prokÔptei èna pakèto prostateumèno apì sfˆlmata, 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 sfˆlmata, eÐnai ìti sta kanˆlia metˆdoshc h poiìthta twn shmˆtwn metabˆlletai kai eÐnai dunatìn ènac megˆloc 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 kˆje pakètou metˆdoshc 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 Sfalmˆtwn, 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 susswmˆtwma twn duadik¸n yhfÐwn pou èqoun uposteÐ sfˆlma metatrèpetai se èna megˆlo 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 sfˆlmata. O isqurìc pleonasmìc pou eisˆgetai apì aut  (100%, kaj¸c o suneliktikìc kwdikopoiht c parˆgei dÔo roèc exìdou, kajemiˆ me ton Ðdio rujmì metˆdoshc ì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 eisˆgetai, na meiwjeÐ diamèsou thc diˆtrhshc (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 diˆtrhshc (puncturing ratio). Me autì ton trìpo, eÐnai pijanì na epiteuqjoÔn oi rujmoÐ k¸dika diˆtrhshc (punctured DVB code rates) pou kajorÐzontai apì to stˆntar (2/3, 3/4, 5/6   7/8), pou ekfrˆzoun 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Ô metˆdoshc kai tou tÔpou thc pareqìmenhc uphresÐac. 3.2.4 ∆iamìrfwsh kai metˆdosh H diadikasÐa thc eswterik c diemplok c parˆgei 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 diagrˆmmata asterismoÔ kai (constellation maps) gia kˆje tÔpo diamìrfwshc perigrˆfontai analutikˆ sthn prodiagraf . Ta sÔmbola omadopoioÔntai kai metadÐdontai tautìqrona me th qr sh poluplexÐac OFDM. e) Kˆje sÔmbolo OFDM apoteleÐtai apì èna sÔnolo N=6817 (8k mod-   1705 (2k mode) ferìntwn kai metadÐdetai me diˆrkeia TS=896msec kai Kefˆlaio 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 katastˆseic leitourgÐac antÐstoiqa. H orjogwniìthta metaxÔ twn ferìntwn exasfalÐzetai apì to gegonìc ìti ∆f=1/TS pˆnta. Me th sunj kh aut , h diˆtaxh twn ferìntwn apoktˆ th morf  tou parakˆtw 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  katˆstash leitourgÐac 8 leitourgÐac twn 7 kai 6 MHz. MHz, To kˆje sÔmbolo dÔo mèrh: èna wfèlimo tm ma me diˆrkeia (guard interval), me diˆrkeia D. en¸ problèpontai kai katastˆseic TU OFDM apoteleÐtai apì kai èna diˆsthma froÔrhshc To diˆsthma froÔrhshc apoteleÐtai apì mia kuklik  epanˆlhyh tou wfèlimou tm matoc, kai eisˆgetai 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 kˆje 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ˆ pˆsa 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 metˆdoshc (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 metˆdosh (rujmìc kwdikopoÐhshc, diˆrkeia 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 Metaforˆc MPEG-2 pou metadÐdetai. H tim  aut  exartˆtai apì th diˆrkeia 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ˆ pˆntwc isqÔei ìti ìso auxˆnei o wfèlimoc rujmìc, tìso pio euˆlwto gÐnetai to s ma se fainìmena dialeÐyewn kai poludiadromik c metˆdoshc (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. Kefˆlaio 3. To prìtupo 34 3.3 DVB Metˆdosh IP dedomènwn pˆnw apì to kanˆli DVB-T 'Opwc anafèrjhke èna qarakthristikì tou prìtupou wsh twn pakètwn bytes IP DVB-T eÐnai h enjulˆk- sta pakèta metaforˆc. Ta pakèta èqoun m koc 188 qrhsimopoi¸ntac tèssera apì autˆ wc enswmˆtwsh twn pakètwn sto IP TS header(epikefalÐda). Gia thn kai gia na diakrijoÔn apì ta yhfiakˆ pakèta thleoptik¸n programmˆtwn qreiazìmaste mia diadikasÐa pou ja ektelèsei th leitourgÐa thc qartogrˆfhshc, thn prosarmog  kai thn katˆtmhsh, 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 enjulˆkwshc. ˆ 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ì kˆje 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 metaforˆc. ˆ Enjulˆkwsh poluprwtokìllwn (Multiprotocol Encapsulation). h teqnik  epitrèpei th metaforˆ diˆforwn 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 diˆkrish 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 katˆllhlh gia mh-amfÐdromh metˆdosh dedomènwn en¸ ta metadidìmena dedomèna eÐ- 3.4. AMFIDROMIK'OTHTA 35 nai sun jwc stìqoc se megˆlh omˆda 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 diˆquth mÐa tˆsh sthn episthmonik  koinìthta na upˆrxei 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 kˆluyhc 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 metˆdosh. 36 Kefˆlaio 3. To prìtupo DVB Kefˆlaio 4 H mèjodoc enjulˆkwshc To ULE (Unidirectional Lightweight Encapsulation) ULE eÐnai èna prwtìkollo enjulˆkwshc sto epÐpedo diasÔndeshc to opoÐo protupopoieÐ thn metaforˆ pakètwn epipèdou diktÔou, ìpwc gia parˆdeigma 2 IP datagrams, surm¸n dedomènwn. Ex aitÐac tou polÔ mikroÔ overhead mèsw MPEG- pou apaiteÐ eÐnai idiaÐtera katˆllhlo gia efarmogèc IP over Satellite ìpou èqei megˆlh shmasÐa h exoikonìmhsh eÔrouc z¸nhc. 'Enac akìmh lìgoc pou mporeÐ na protimhjeÐ aut  h mèjodoc enjulˆkwshc, 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 enjulˆkwshc èqei wc bˆsh to MPE). MPEG-2, eÐnai katˆllhlh gia na enswmatwjeÐ sthn arqitektonik  tou DVB prosfèrontac ètsi èna monìdromo (simplex) kanˆli 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) kanˆlia 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 perigrˆfetai sto ULE den èqei gÐnei standard. RFC 4326 [3] thc IETF. Mèqri s mera (2007) To prìtupo perigrˆfei ènan mhqanismì enjulˆkwshc 37 Kefˆlaio 4. H mèjodoc enjulˆkwshc 38 o opoÐoc kajistˆ dunat  thn metaforˆ IPv4 kai IPv6 ULE dedomenografhmˆtwn kaj¸c kai pakètwn ˆllwn diktuak¸n prwtokìllwn kateujeÐan pˆnw ston MPEG-2 surmì metaforˆc me thn morf  TS Private Data. To RFC 4326 prodiagrˆfei thn basik  morf  thn enjulˆkwshc 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. enjulˆkwshc mporeÐ na analujeÐ se trÐa basikˆ stˆ- dia. Arqikˆ prèpei na dhmiourg soume   me kˆpoion trìpo na anakt soume thn plhroforÐa pou ja epexergastoÔme. Aut  upˆrqei sthn morf  pakètwn epipèdou diktÔou, ìpwc gia parˆdeigma plaÐsia Ethernet kai IP dedomenograf mata. Ta pakèta autˆ, ta opoÐa onomˆzoume PDUs (Protocol Data Units), odhgoÔntai sthn eÐsodo tou enjulakwt . Sthn sunèqeia o enjulakwt c morfopoieÐ kˆje PDU se èna pakèto SNDU (SubNetwork Data Unit) to opoÐo kai apoteleÐ èna ULE pakèto. H mor- fopoÐhsh kˆje pakètou perilambˆnei thn prosj kh thc kefalÐdac enjulˆkwshc prin to PDU kai sto tèloc mia akoloujÐa elègqou akeraiìthtac tessˆrwn Bytes. O èlegqoc akeraiìthtac epitugqˆnetai me ènan algìrijmo CRC32 me ta qarakthristikˆ pou perigrˆfontai 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ì kanˆli enìc p c DVB TS surmoÔ kai na ton akolouj sei se mia alusÐda ekpom- ètsi ¸ste na ftˆsei 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 enjulˆkwshc eÐqame sumperilˆbei 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 perˆsei pˆnw 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 gkˆma 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 parˆdeigma 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 tˆxhc twn 2 mia diìlou eukatafrìnhth posìthta gia ta dedomèna miac mèshc pìlhc. Sq ma 4.2: To diˆgramma leitourgÐac enìc ULE enjulakwt . Kefˆlaio 4. H mèjodoc enjulˆkwshc 40 4.2 SÔgkrish Stic mèrec mac h kÔria mèjodoc enjulˆkwshc 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 qreiˆzetai me apotèlesma na èqoume spatˆlh 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èrontˆc 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 metˆdoshc wfèlimhc plhroforÐac gia orismènec efarmogèc. Autì ofeÐletai sto shmantikˆ mikrìtero overhead pou apaiteÐ gia thn metˆdosh 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 upˆrqei shmantik  èreuna se exèlixh kai arketì endiafèron, akìma den èqei gÐnei standard lìgw tou ìti h emfˆnis  tou sthn episthmonik  koinìthta (RFC 4342) eÐnai sqetikˆ prìsfath. Autì èqei wc apotèlesma na mhn upˆrqei 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 upˆrqei sqedìn kajolik  upost rixh afoÔ opoiad pote platfìrma mporeÐ na trèxei Linux. 42 Kefˆlaio 4. H mèjodoc enjulˆkwshc ULE Kefˆlaio 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 skiagrˆfhsh twn apait sewn apì pleurˆc 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 metaforˆc 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 katˆllhla 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 qreiˆzetai na kˆnei qr sh enìc apì ta prwtìkolla pou qrhsimopoioÔn suskeuèc aut c thc klˆshc gia na antallˆxoun 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 Kefˆlaio 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 enjulˆkwshc. '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ì pleurˆc 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 anˆmesa sthn alusÐda ekpomp c DVB-T kai ston qr sth. O qr sthc prèpei, me kˆpoion 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 lˆbei 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 lambˆnei thn ro  tou prèpei na upˆrqei ènac DVB-T receiver DVB, t¸ra, ¸ste na lˆbei 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 metafrˆsei 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 pˆnw 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 ftˆsoun 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 enjulˆkwsh apostèlnontan ston enjulakwt  mèsw enìc Ethernet interface. 'Etsi h efarmog  enjulˆkwshc ìfeile na ta lˆbei diabˆ- zontac ta pakèta pou kateujÔnontan proc to mhqˆnhma. Akìmh, o enjulakwt c ofeÐlei na teleÐ tautìqrona arketèc diadikasÐec. Prèpei na mporeÐ na lambˆnei 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 allhlepidrˆsei me to ASI interface, pou upˆrqei sto mhqˆnhma, ¸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 enjulˆkwsh. 'Ola ta dedomèna pou lambˆnontai kai ekpèmpontai apì ton enjulakwt , prèpei na apojhkeÔontai proswrinˆ sthn mn mh me thn bo jeia kˆpoiou 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 enjulˆkwshc packing. bit rate ìpwc kai 46 Kefˆlaio 5. Sqediasmìc Kefˆlaio 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 kˆrta diktÔou kai mia MBytes SD RAM, DVB Master III Tx efodiasmènoc me mia kˆrtac 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 egkatˆstash twn odhg¸n thc kˆrtac III Tx, DVB Master oi opoÐoi parèqontai apì thn kataskeuˆstria etairÐa. Prin mporèsei, bèbaia, kaneÐc na steÐlei kˆti apì thn kˆrta 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 kˆrta. Oi metabol  twn tim¸n aut¸n epidrˆ sthn epÐdosh tou sust matoc. 'Etsi gia na upˆrxei 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 Kefˆlaio 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- sqediˆsthke 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 kˆrta 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 diˆfanhc proc ton qr sth kai to leitourgikì. 6.2. ULOPO'IHSH DIKT'UOU Sq ma 6.2: H kˆrta 49 DVB Master III Tx. Gia na ftˆsoun ìmwc ta dedomèna apì ton enjulakwt  sthn kˆrta 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 enjulˆkw- shc. Autì eÐnai anagkaÐo ¸ste na eÐnai efikt  h pro¸jhs  tou sthn alusÐda ekpomp c h opoÐa perigrˆfetai analutikìtera parakˆtw. AfoÔ ta dedomèna ftˆsoun sthn alusÐda ekpomp c, aut  analambˆnei 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 mpˆnta twn UHF. Metˆ apì autì to stˆdio opoiosd pote qr sthc, o opoÐoc brÐsketai entìc thc perioq c kˆluyhc, 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 apoenjulˆkwshc 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 lˆbei ta ekpempìmena dedomèna. SÔmfwna me ta parapˆnw 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ˆ Kefˆlaio 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 ftˆnei 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 diˆjes  mÐa koin  kˆrta l yhc DVB-T, lambˆnei 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 Anˆptuxhc Thlepikoinwniak¸n Susthmˆtwn 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 diˆsthma fÔlaxhc (guard interval) Ðso me to 1/32 tou m kouc sumbìlou. Oi parˆmetroi 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 (kanˆli 29) me epÐpedo dÔnamhc (power level) 0dBm kai to sugkekrimèno kanˆli èqei eÔroc 8MHz. 52 Kefˆlaio 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 kˆje jèsh kai to mègisto pl joc jèsewn pou mporeÐ na uposthrÐxei o buer. 6.3.2 EpikoinwnÐa me thn kˆrta Prokeimènou na prowjhjoÔn ta pakèta sthn kˆrta to prìgramma qrhsimopoieÐ k¸dika o opoÐoc parèqetai me touc odhgoÔc thc kˆrtac kai frontÐzoun gia thn arqikopoÐhsh thc. 6.3.2.1 ArqikopoÐhsh Gia thn arqikopoÐhsh thc kˆrtac tropopoi jhke to arqeÐo txtest.c ¸ste antÐ na stèlnei thn kÐnhsh pou lambˆnei san eÐsodo, aplˆ na arqikopoieÐ thn kˆrta me ta orÐsmata pou parèqontai katˆ thn kl sh thc efarmog c. Ta orÐsmata autˆ eÐnai h kˆrta 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 sunˆrthsh faÐnetai parakˆtw. // 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 kˆrtac, 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 kˆrta kˆnontac 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 anˆkthsh twn IP pakètwn apì to dÐktuo ¸ste autˆ na upostoÔn thn diadikasÐa thc enjulˆkwshc. 'Ena autìnomo thread analambˆnei aut n thn diergasÐa h opoÐa analÔetai parakˆtw. 6.3.3.1 Biblioj kh libpcap Gia thn anˆkthsh pakètwn apì èna dÐktuo upˆrqei è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 kˆnontac qr sh tou libpcap C h efarmog  pou anaptÔqjhke eÐnai se jèsh na sullèxei apì to dÐktuo ta proc enjulˆkwsh 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 enjulˆkwshc packing, ta IP pakèta pou sullègontai qrhsimopoioÔntai anˆ sugkekrimèna qronikˆ diast mata, prèpei kˆpou na gÐnetai h proswrin  apoj keush twn pakètwn. Gi' autìn ton skopì kataskeuˆsthkan oi perigrˆfontai sto kefˆlaio 6.3.1. buers pou Kefˆlaio 6. UlopoÐhsh 54 H arqikopoÐhsh tou buer gÐnetai me thn parakˆtw entol . Oi timèc shmaÐnoun ìti to mègisto mègejoc pakètou eÐnai 1540 kai upˆrqei dunatìthta gia apoj keush wc kai qilÐwn pakètwn. Dedomènou ìti o buer autìc apojhkeÔei ta pakèta pou ftˆnoun se diˆsthma 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 Enjulˆkwsh H enjulˆkwsh 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 enjulˆkwshc Ed¸ parousiˆzetai o algìrijmoc thc diadikasÐac thc enjulˆkwshc. Enjulˆkwsh 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 diˆshme adrˆneiac, 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 upˆrqei sthn kefalÐda tou TS pakètou èqei kajoristeÐ sÔmfwna me to prìtupo ISO-MPEG2. Aut  h tim  prèpei na auxˆnetai katˆ èna (modulo 16) gia kˆje 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 upˆrqei diajèsimoc q¸roc se èna mh pl rec h diadikasÐa eÐnai gnwst  wc upˆrqoun ˆ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 pˆroun 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 antallˆssei meiwmènh apodotikìthta me beltiwmènh kajustèrhsh. Enallaktikˆ, an upˆrqoun perissìtera pakèta en anamon  ston enjulakwt , kai èna pakèto èqei arketì upoleipìmeno q¸ro metaforˆc, 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 enjulˆkwsh enìc SNDU upˆrqoun 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 xekinˆei h metˆdosh enìc nèou SNDU se èna nèo TS pakèto. 2. An to TS pakèto pou perièqei to teleutaÐo kommˆti 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 kommˆti 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 metˆdosh tou epìmenou SNDU se èna nèo TS pakèto. Kefˆlaio 6. UlopoÐhsh 56 4. An to TS pakèto èqei pˆnw 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 metˆdosh tou epìmenou SNDU se èna nèo TS pakèto. 5. An toulˆqiston dÔo byte eÐnai diajèsima (me ˆlla logÐa, trÐa byte an to PUSI DEN èqei pˆrei tim  1  dh, kai dÔo byte an èqei pˆrei 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 paketˆrei TS pakèto ìpou to PUSI den èqei pˆrei tim  1, to PREPEI na pˆrei tim  1, kai ènac 8-bit eisaqjeÐ sto pr¸to byte An den upˆrqoun ˆ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 eisˆgei è- nan deÐkth tèlouc. 6.3.4.2 UlopoÐhsh enjulakwt  Sto sq ma 6.5 faÐnetai to diˆgramma ro c thc diadikasÐac thc enjulˆkwshc qrhsimopoi¸ntac thn mèjodo autìnomo H enjulˆkwsh lambˆnei q¸ra se èna thread. Basikìc brìgqoc bˆnetai kˆje 5 tai an o packing. buer ms. H enjulˆkwsh gÐnetai se ènan brìgqo o opoÐoc epanalam- Arqikˆ gia thn eÐsodo ston brìgqo enjulˆkwshc elègqe- pou kratˆei ta sulleqjènta den qreiˆzetai na gÐnei enjulˆkwsh IP pakèta eÐnai ˆdeioc   an apì prin èqei meÐnei èna opìte SNDU pou den èqei oloklhrwjeÐ h enjulˆkws  tou opìte kai qreiˆzetai na suneqisteÐ h diadikasÐa. 6.3. ULOPO'IHSH EFARMOG'HS 57 'Otan gÐnei h eÐsodoc ston brìgqo, an upˆrqei diajèsimh arket  plhroforÐa, aut  prowjeÐtai se èna TS pakèto, alli¸c anaktˆtai to epìmeno SNDU apì ton IP buer. Sto epìmeno stˆdio, an kai ìso upˆrqoun dedomèna pˆnw apì 184 proc enjulˆkwsh ta prowjeÐ se epìmena TS pakèta. 'Epeita, an èqei epilegeÐ h mèjodoc enjulˆkwshc bytes èqoun apomeÐnei se èna bytes (diadikasÐa packing, buer stung). TS bytes padding, grˆfontai ìsa pakèto kai to upìloipo gemÐzetai me null An h epilegmènh mèjodoc enjulˆkwshc eÐnai h tìte, an upˆrqoun ˆlla diajèsima SNDU diabˆzontai 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 epanˆlhyh h enjulˆkwsh xekinˆei apì autˆ. An den upˆrqoun 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 pˆli eÐsodoc ston brìgqo enjulˆkwshc kai epanalambˆnetai aut  h diadikasÐa, mèqri na adeiˆsei o IP buer. Mìlic telei¸sei o brìgqoc enjulˆkwshc, prèpei na diapistwjeÐ eˆn 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 kˆrta. Autì gÐnetai se ènan brìgqo ìpou diabˆzontai èna èna ta pakèta apì ton TS buer kai prowjoÔntai sthn kˆrta. AfoÔ gÐnei kai autì upˆrqei mia anamon  5 ms kai h ro  tou progrˆmmatoc epistrèfei ston kÔrio brìgqo. 6.3.4.3 Crc checksum Kˆje 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 Kefˆlaio 6. UlopoÐhsh Sq ma 6.5: Diˆgramma ro c gia thn mèjodo tou packing. 6.3. ULOPO'IHSH EFARMOG'HS 59 6.3.4.4 TS buer Kˆje pakèto pou TS apojhkeÔetai se ènan pou parˆgetai katˆ thn diadikasÐa thc enjulˆkwshc buer o opoÐoc èqei arqikopoihjeÐ katˆllhla 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 kˆrtac. To bit rate prèpei na diathreÐ- tai stajerì kai o buer thc efarmog c èqei arqikopoihjeÐ katˆllhla ¸ste, an adeiˆzei 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 qreiˆzetai akrib¸c ¸ste na diathrhjeÐ to bit rate stajerì. H apostol  twn dedomènwn, t¸ra, gÐnetai me thn sunˆrthsh tp_send pou perigrˆfhke sto kefˆlaio 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. Kˆje pakèto èqei eidik  shmasÐa mèsa se ènan MPEG2 surmì dedomènwn. Ta pakèta pou qrhsimopoi jhkan apì thn efarmog  perigrˆfontai parakˆtw. 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 pˆnta 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 perigrˆfei to monadikì prìgramma mèsa ston sur- Kefˆlaio 6. UlopoÐhsh 60 mì dedomènwn pou dhmiourgeÐtai. To prìgramma autì eÐnai ta enjulakwmèna dedomèna. Parakˆtw 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 progrˆmmata. Gia kˆje prìgramma upˆrqei èna PMT to opoÐo me thn seirˆ tou emfanÐzetai se èna sugkekrimèno PID. To PMT perigrˆfei poia perièqoun dedomèna   meta- PID dedomèna gia to sugkekrimèno prìgramma. Gia parˆdeigma 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 Parakˆtw 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 upˆrqoun 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) progrˆmmatoc kai ton paroqèa. To Parakˆtw 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 pˆnta 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Ô kˆje 100ms ¸ste na gÐnetai h swst  anagn¸ris  tou. Gi' autìn ton skopì upˆrqei ènac brìgqoc o opoÐoc analambˆnei 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 Kefˆlaio 6. UlopoÐhsh Kefˆlaio 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, qreiˆsthkan orismèna progrˆmmata ta opoÐa mporoÔn na d¸soun thn dunatìthta na dhmiourghjeÐ kÐnhsh sto dÐktuo, na metrhjeÐ kai na analujeÐ. Ta progrˆmmata pou qrhsimopoi jhkan ja perigrafoÔn parakˆtw. 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   lambˆnontai se mia kˆrta 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, bˆsei 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 kˆje mètrhsh, qrhsimopoioÔntai sthn metèpeita anˆlush. 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 Kefˆlaio 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- fwmˆtwn 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  upˆrqei se èna kanˆli yhfiak c thleìrashc sto opoÐo pr¸ta prèpei na èqei suntonisteÐ qrhsimopoi¸ntac mia kˆrta 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 analambˆnei na to apoenjulak¸sei kai na to prowj sei sto eikonikì diktuakì interface pou èqei kataskeuˆsei. Aut  h diadikasÐa eÐnai diˆfanh sto leitourgikì sÔsthma, me apotèlesma ta dedomèna pou dromologoÔntai mèsw twn UHF na ftˆnoun amèswc ston telikì qr sth me thn morf  diktuak c kÐnhshc. 'Ena megˆlo atoÔ tou dvbnet eÐnai to gegonìc ìti uposthrÐzei ed¸ kai kairì tic dÔo basikèc morfèc enjulˆkwshc, 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ì-enjulˆkwshc. 7.1.4 scripts Gia thn anˆlush 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Ðnontˆc touc san eÐsodo èna arqeÐo me ta pakèta pou stˆljhkan 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 katˆllhlo gia thn dhmiourgÐa grafhmˆtwn apì arqeÐa dedomènwn ìpwc ta arqeÐa pou proèkuyan apì thn anˆlush twn metr sewn. 7.2 Senˆria metr sewn Gia na metrhjeÐ h apìdosh tou diktÔou stˆljhkan 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 stˆljhkan me to mgen  tan diˆrkeiac 30 deuterolèptwn kai eÔrouc 1500 Kbps. To mègejoc tou pakètou kai h mèjodoc enjulˆkwshc (packing   padding)  tan oi exarthmènec metablhtèc se kˆje 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 kˆrtac. Autì, sthn ousÐa, shmaÐnei ìti qreiˆzetai na dojoÔn oi katˆllhlec timèc arijmoÔ kai megèjouc twn buers thc kˆrtac. Gia na anebrejoÔn oi pio katˆllhlec timèc, oi timèc dhlad  me tic opoÐec to sÔsthma sumperifèretai me ton kalÔtero trìpo, qreiˆsthke 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ì: Kefˆlaio 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 lambˆnei ta dedomèna, ta enjulak¸nei se ènan surmì dedomènwn kai ta prowjeÐ, mèsw thc diajètei, sthn DVB-T ASI kˆrtac pou alusÐda ekpomp c. ˆ Thn DVB-T alusÐda ekpomp c, h opoÐa lambˆnontac ton surmì dedomènwn analambˆnei gia thn ekpomp  tou.1 ˆ 'Enan deÔtero qr sth, o opoÐoc diajètei mÐa kˆrta l yhc DVB-T kai mèsw katˆllhlou 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 progrˆmmata UDP ro  dedomènwn 1,5 Mbps h opoÐa mgen. Gia thn exagwg  apotelesmˆtwn eÐnai aparaÐthto na anakt soume, me kˆpoion trìpo, ìla ta pakèta pou metafèrjhkan sto dÐktuo katˆ thn diˆrkeia thc mètrhshc. Autì epitugqˆnetai me thn qr sh tou ergaleÐou tcpdump to opoÐo qrhsimopoieÐtai gia na piˆsei pakèta ta opoÐa ftˆnoun se èna diktuakì terface. in- Qrhsimopoi jhke me ta katˆllhla orÐsmata gia na apojhkeutoÔn ta pakèta se èna arqeÐo to opoÐo metˆ qrhsimopoi jhke gia thn anˆlush. DÔo tètoia arqeÐa eÐnai aparaÐthta gia thn anˆlush& èna me pakèta pou estˆlhsan 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 katˆllhla scripts ex qjhsan ta apotelèsmata 3 . Gia kˆje 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 qˆjhkan se kˆje mètrhsh. Ta apotelèsmata parousiˆzontai 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 ephreˆzontai 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 kˆrtac 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ˆ- Kefˆlaio 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 parastˆseic 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 stˆljhke 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 enjulˆkwshc packing. 1425 padding kai èna qrhsimopoi¸ntac thn mèjodo Gia kˆje 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 anˆlush kai o upologismìc ka- justèrhshc, apwlei¸n k.a. qreiˆsthke 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 parakˆtw. % 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 kˆje mètrhsh kai kal¸ntac gia kˆje zeÔgoc to bash script ipv4_udp, to opoÐo paratÐjetai sto parˆrthma Bþ.2.1.1, ex qjhsan ta apotelèsmata thc anˆlushc. Ta apotèlesma twn metr sewn parousiˆzontai sto kefˆlaio 9.1, kai analutikˆ ta diagrˆmmata gia kˆje mètrhsh upˆrqoun sto parˆrthma Aþ. 70 Kefˆlaio 7. 'Elegqoc Kefˆlaio 8 LeitourgÐa 8.1 8.1.1 Egkatˆstash Egkatˆstash odhg¸n kˆrtac H egkatˆstash twn odhg¸n thc kˆrtac eÐnai mia apl  diadikasÐa. Ston katˆlogo pou upˆrqoun 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 egkatˆstash twn odhg¸n kai tèloc h dhmiourgÐa twn device nodes 1 sta opoÐa eÐnai antistoiqismènh kˆje kˆrta pou upˆrqei sto sÔsthma. AfoÔ, t¸ra, èqoun egkatastajeÐ oi odhgoÐ thc kˆrtac, mporoÔn na fortwjoÔn sto sÔsthma me thn entol : # modprobe dvbm 1 Στα Unix συστήματα, κάθε συσκευή υλικού αντιστοιχίζεται σε ένα ειδικό αρχείο το οποίο βοηθάει στην διαφανή επικοινωνία των εφαρμογών επιπέδου χρήστη με το υλικό. Αυτού του είδους τα αρχεία αποκαλούνται device nodes. 71 72 Kefˆlaio 8. LeitourgÐa Sta perissìtera sust mata oi odhgoÐ ja fort¸nontai autìmata me to pou aniqneÔetai h Ôparxh thc kˆrtac. An autì den gÐnetai autìmata se kˆpoio sÔsthma, eÐnai dunatìn na anagkasteÐ to sÔsthma na fort¸nei touc odhgoÔc katˆ thn diˆrkeia thc ekkÐnhshc me thn parakˆtw 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 kˆrta prèpei na eÐnai antistoiqismènh me to device node /dev/asitx0. Gia na tropopoihjoÔn oi rujmÐseic thc kˆrtac me diadrastikì trìpo upˆrqei h ex c entol : # txcfg / dev / a s i t x 0 Tèloc gia na diapistwjeÐ h swst  leitourgÐa thc kˆrtac 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 kˆrta 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ˆ kanˆlia pou ekpèmpon- tai apì thn platfìrma DVB-T, ìpwc faÐnetai kai sto parakˆtw screenshot . ParathreÐtai ìti aniqneÔontai 5 thleoptikˆ progrˆmmata ta opoÐa apojhkeÔontai sth sunèqeia se èna arqeÐo pou to onomˆzoume Tèloc, me thn entol  tzap, mychannels. parèqetai h dunatìthta gia suntonismì se kˆpoio apì ta aniqneÔsima progrˆmmata se mia sugkekrimènh suqnìthta, ìpwc parathreÐtai kai apì to screenshot . 8.1.3 dvbnet Gia na gÐnetai autìmata h apoenjulˆkwsh 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 parakˆtw 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 kˆrta 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 kˆrta 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 kˆrtac. ParametropoÐhsh Gia na upˆrqei stajerìc rujmìc dedomènwn, prˆgma pou apaiteÐ to prwtìkollo ASI, prèpei na rujmisteÐ h kˆrta ¸ste na eisˆgei 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 kˆrta, prèpei na brejoÔn oi katˆllhloi buers. H diadikasÐa pou akolouj jhke sta plaÐsia aut c thc èreunac peri- grˆfetai sto kefˆlaio 7.3.1. An, gia parˆdeigma, o katˆllhloc 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 Kefˆlaio 8. LeitourgÐa Kefˆlaio 9 ParousÐash metr sewn 9.1 ParousÐash apotelesmˆtwn Gia thn axiolìghsh tou diktÔou èginan oi metr seic pou anafèrjhkan. Apì ta apotelèsmata dhmiourg jhkan ta diagrˆmmata gia thn apìdosh tou diktÔou, ta opoÐa faÐnontai parakˆtw. 9.1.1 Apìdosh Apì ta apotelèsmata dhmiourg jhkan ta diagrˆmmata gia thn apìdosh tou diktÔou, ta opoÐa faÐnontai parakˆtw. 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 moirˆzontai anˆ 184 bytes null bytes. gia na enjulakwjoÔn sta to upìloipo thc diaÐreshc tou m kouc tou auxˆnetai 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 plhsiˆzei 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 diˆgramma thc apìdoshc ìso metabˆlletai to mègejoc tou To packing, tou epìmenou IP pakètou. an upˆrqei 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 Kefˆlaio 9. ParousÐash metr sewn 76 pou alli¸c ja p gaine qamènoc. Autì to gegonìc kˆnei 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 upˆrqei epeid  prostÐjetai h plhroforÐa apì to overhead thc enjulˆkwshc, o lìgoc autìc eÐnai logikì na mac dÐnei thn eikìna thc apìdoshc thc ULE enjulˆkwshc. 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 enjulˆkwshc [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 kˆje pakèto gia na ftˆsei ston proorismì tou apì thn ¸ra pou xekÐnhse apì ton apostolèa. Oi mèsoi ìroi thc kajustèrhshc gia kˆje set metr sewn faÐnetai sto diˆgramma 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 diˆgramma 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 anexˆrthta apì to mègejoc pakètou. 'Ara se sqèsh me thn kajustèrhsh den faÐnetai kˆpoia mèjodoc na upertereÐ se sqèsh me mia ˆllh. Kefˆlaio 9. ParousÐash metr sewn 78 9.1.3 Metabol  thc kajustèrhshc Ed¸ parousiˆzontai ta apotelèsmata thc anˆlushc gia thn metabol  thc kajustèrhshc. Aut  h tim  apeikonÐzei thn metabol  thc kajustèrhshc anˆmesa 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 parousiˆzontai 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 enjulˆkwshc. Ap' ìti faÐnetai apì to diˆgramma h metabol  thc kajustèrhshc auxˆnetai 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 parousiˆzontai sto diˆgramma 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 qˆjhkan se sqèsh me me ta pakèta pou estˆlhsan. 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 auxˆnetai ekjetikˆ ìso mei¸netai to mègejoc tou pakètou. Autì, ìpwc, anafèrjhke kai pio pˆnw, ofeÐletai sto ìti oi buer eÐnai rujmismènoi gia èna sugkekrimèno rujmì metˆdoshc. An exairejeÐ h perÐptwsh twn polÔ mikr¸n megej¸n pakètwn, parathreÐtai ìti to posostì twn apwlei¸n plhsiˆzei to 0 kai gia touc dÔo tÔpouc enjulˆkwshc. Kefˆlaio 9. ParousÐash metr sewn 80 9.2 Sqoliasmìc apotelesmˆtwn 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 upˆrqoun roèc me polÔ mikrì mègejoc pakètwn ìpou h kajustèrhsh auxˆnetai dramatikˆ, allˆ paramènei se anektˆ epÐpeda. H metabol  thc kajustèrhshc diathr jhke se qamhlˆ epÐpeda kai  tan anˆlogh me to mègejoc tou pakètou. Oi timèc thc kumˆnjhkan 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 kˆtw, sunepˆgetai ìti to dÐktuo pou anaptÔqjhke den eÐnai eupajèc stic metabolèc thc kajustèrhshc. ParathroÔntai megˆlec ap¸leiec gia mikrì mègejoc pakètou. Autì ofeÐletai sto ìti oi buers thc kˆrtac èqoun rujmisteÐ gia bèltisth leitourgÐa se èna sugkekrimèno rujmì metˆdoshc dedomènwn. 'Oso mei¸netai to mègejoc tou pakètou, ìmwc, tìso auxˆnetai o rujmìc metˆdoshc, kaj¸c auxˆnetai to overhead anˆ qrìno anˆ pakèto. Kefˆlaio 10 Sumperˆsmata Skopìc aut c thc ptuqiak c ergasÐac  tan h metaforˆ diktuak¸n pakètwn pˆnw apì èna kanˆli UHF me thn teqnologÐa thc yhfiak c thleìrashc. Gia ton skopì autì kataskeuˆsthke è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 katˆllhlo exoplismì. H axiolìghsh thc sumperiforˆc tou diktÔou sthn metˆdosh apì shmeÐo se shmeÐo ègine kˆnontac 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 kˆluyhc 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 Kefˆlaio 10. Sumperˆsmata 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 Parˆrthma Aþ Diagrˆmmata 87 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata 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 Parˆrthma aþ. Diagrˆmmata Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 } Parˆrthma 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 Parˆrthma 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 }; Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 anˆlushc 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 Parˆrthma 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 Parˆrthma 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 } Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 Parˆrthma 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 # # # # # # # # # Parˆrthma 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 Parˆrthma 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 Parˆrthma 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