From 93a2bdef2eb312ff62bf09e5e41fc37cf6bbf253 Mon Sep 17 00:00:00 2001 From: r1pper Date: Wed, 22 Jul 2015 20:00:24 +0430 Subject: [PATCH 01/20] release mode changed make to compile as release --- c/Corelatus-GTH-example-code.sdf | Bin 0 -> 393216 bytes c/Corelatus-GTH-example-code.v12.suo | Bin 0 -> 10240 bytes c/NMakefile | 3 ++- c/connect_timeslots.obj | Bin 0 -> 3123 bytes c/disable.obj | Bin 0 -> 2102 bytes c/duplex_lapd.obj | Bin 0 -> 7196 bytes c/enable.obj | Bin 0 -> 2712 bytes c/gth_apilib.obj | Bin 0 -> 39566 bytes c/gth_client_xml_parse.obj | Bin 0 -> 17095 bytes c/install_release.obj | Bin 0 -> 5248 bytes c/install_start_script.obj | Bin 0 -> 3824 bytes c/map.obj | Bin 0 -> 2260 bytes c/monitor_dtmf.obj | Bin 0 -> 2874 bytes c/playback_file.obj | Bin 0 -> 4754 bytes c/query_set.obj | Bin 0 -> 4053 bytes c/record.obj | Bin 0 -> 6014 bytes c/save_to_pcap.obj | Bin 0 -> 20791 bytes c/unmap.obj | Bin 0 -> 2016 bytes c/version.obj | Bin 0 -> 614 bytes 19 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 c/Corelatus-GTH-example-code.sdf create mode 100644 c/Corelatus-GTH-example-code.v12.suo create mode 100644 c/connect_timeslots.obj create mode 100644 c/disable.obj create mode 100644 c/duplex_lapd.obj create mode 100644 c/enable.obj create mode 100644 c/gth_apilib.obj create mode 100644 c/gth_client_xml_parse.obj create mode 100644 c/install_release.obj create mode 100644 c/install_start_script.obj create mode 100644 c/map.obj create mode 100644 c/monitor_dtmf.obj create mode 100644 c/playback_file.obj create mode 100644 c/query_set.obj create mode 100644 c/record.obj create mode 100644 c/save_to_pcap.obj create mode 100644 c/unmap.obj create mode 100644 c/version.obj diff --git a/c/Corelatus-GTH-example-code.sdf b/c/Corelatus-GTH-example-code.sdf new file mode 100644 index 0000000000000000000000000000000000000000..4d8cd8f597cf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900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p z2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?x zfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=9 z00@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p z2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!Ozu HC-DCPR8z%o literal 0 HcmV?d00001 diff --git a/c/Corelatus-GTH-example-code.v12.suo b/c/Corelatus-GTH-example-code.v12.suo new file mode 100644 index 0000000000000000000000000000000000000000..7d2ce174576d52c5638b64108f6c09a19f2c1ec1 GIT binary patch literal 10240 zcmeI2OKenC7{^a}C@(>tYDKJ+mqKfKw;-B!S}3NqgqD^?6I1%4Fic5j3ME?ON)0|j z)I=AWfWd{tU`UKcSBh>}(HLE*8!#~}Fi}^!fY#st-g`RtPCK1D?FbTkCf_~hp8MVN zJ47sJ=0)o-!r+F%@$Xz1{9NPQ$@Fu% z|1&cv_SCfNTi^P2Aa4$MU)|#(@4@1_%^|ZJ>+4`tW%@F#5`4Ubh?K4Vx3C1^%W382 zD8H!bGOeZs`|pB>n8Qt+ai=-RT-?JQty?n=`kPs3hPPM)RO9BbsexJ?TKl-RqZ2zn z7HuuD!c56q>a8a|c*~C2ZSwGiWOX-duGDd^9_LPU9A!t2TU(AyHYnH zWdh0vM@Z`8r(O%7{~(hKfw1zg2X~RTP%8Zj^xO^)hw)0?j{YzI>Ma zP+0npfcuMA$fT!#0&AB=M!`A;0L#2ZyEq zFt`n#NU8Kkw?988L0xQuzT$w+Q&{@Tz)iRRE+s`m>7d=X@wt|}7?$DA`Z>V=WUc>) zJbtx~%|B%K$^%@gJ$Rvn;|Vf(AjMzFEt$f~FWK`{IMYNoft)>#=Z)fLyWm1z)^gU) z8AzCjqXA(mOHW$EwsFW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J2v+mQeO literal 0 HcmV?d00001 diff --git a/c/duplex_lapd.obj b/c/duplex_lapd.obj new file mode 100644 index 0000000000000000000000000000000000000000..264b2718361b9e2f85f2f237583229f3e9ab36d3 GIT binary patch literal 7196 zcmcIpe{3AZ6&~AX#~co}!6_-wvbc8bH1@@3JC2h&sZDYup>}e%W1xz|vA*5&t$nw9 zz1_1Ngb~$|f_u0EiAc0nRj4XTOMd{W5}+hF!H|@O%4t)PN=X~iv`t7Pp#7t&8sUC# zX7{{z4u$^Fjdtdn@4b2R=FOYg^Q61L!+yH&=L5x6jD3ZP$EPIKur;RIO|}c*7f!>e zy%o%-s6(mYntq4+2|#6m(-L(jtGLyt$d>G)pDAYSz#_fQ8K0$2ST%9oQLQdzOkKj* zL*;@oQAsR#k0eQ}HU)0$8tC59z4g|0)v1)G_+r{n^(Ufx`tR7-w zgBy*c8k4P**|>SfmPU0#jwfPjW7tsC!SJAxLSrHnlM{;17#d;gSVtwRW^4(&7Q;;L zX4$$&3nvZJh*(m6-wJ7a!qVc}y_!BOZ8YKuEv6>PuSimkgUiV%&0MLN^yiv()5UtjLVj0 z=+y1M`kjP#Cgv4`UlLo7e-dj)pQsv(8Pd3sj4A(fe;u|A7KL4!Zwe8jnCWa7eAG2p zcf_uwN4}5AF-?)MbgCIMEK`y(KYwFmi@!nA4NIz3d{Wntk+iUeUeY%$nKz{FuHYs+ zK0c{FsWv84x-_m?Q3=69e6A2G-i0=rWE$a7)siAfBQ7BarIfBtB(R}XCAM1%#|%?d zFq#r;R59LAOf#d68kPflUe(4_r9t9WVwyfGX{MA)cyo2bh93E7{hBYe`Rb^!zhLVO-T1*K=4b#%G>51}s-O4)~$972_ zbP#O~Zjd@~PU)zegxnzQ?10-Fc6q%4;qlh~P1{7I44pe{B5|~chHdI}@_D_DW9#6k zrej)|Q&(`Sv!#*YJdw`W%Z`KEd$PPrEDQyi(vVxBdri`3+rs1{y zv{eKCRXhAR7A!Rx!77x6^)i>9EjpZ)mb#>i`<9N( z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(?qAITW5`bOFq*~zUSz)K9|R|x17soS{Z`l?zPsxJfCT;$!Av6k3&~4zkl_U`OKQR zJf_88h9J9pwYGQUF{_)R`AqW<@|o5X`Al0q%(^YFZl^QK&9tqx@^so;?#pLdAIxXk z9?4_YHb0Tiw9Mu*O|9+c^O?0fkToFjiriS;q~tMeO%LZY{zvnf<|p!*mM61}`$8Ir z5^|NUq)nimxBN1U%6>@ZJO~pWI>VhuFttt-wP5Ib;5>q%Z-Da%hIXp+6ta+MCBq5a z67xs0?d)_EP}@53gw2r-^}=14iy=5_x2Y0i-M5IzEMmUBh@oEw&V#WOO?6syA_~hd zW+{hxeGzkd5%c#PCNykCL%2T{q+^GEJ>)W<&0#_*Qy#WG@?`y?-xm*{8!?na_$>nF z9=r?8cC^U-1x5xlm&3%tJO={{mUmMxq=V=cipv_sJ&3Qvg3dJQ@P}qm)4k14nb5&? zcs_%nqmRB@JnKk@J}Ky{C9HF3K=*6D9^q;&txo0L`dB`xDA7MDlW z5H7_nRS$`qbit3yxOm0Ydq@t4)dbw4p1L~D|1$^0Zd?n8#x=dAIb>g&hOzN*pPx!# z2gX!2f$YUd3T7bg1w%1EByc38G*=< pQd!75Lo`$>sad;2;iwuO#SD#6O{L&C*T*cBdv}b$xH@rl_8)Eqz*qnP literal 0 HcmV?d00001 diff --git a/c/enable.obj b/c/enable.obj new file mode 100644 index 0000000000000000000000000000000000000000..1cec1e8170ae011ff7796c8d13bc5a4f1e0a2a33 GIT binary patch literal 2712 zcmb7GO>7%Q6duLzJqmAe%TzAy`r5G%;yV(zuOXBcgF50Tj@s>-?m>Gu5%ODrkZs@_w#VV4B=H)hv~xKA z(qL*VIX1dC+U7W_BIMOf+kaAzPaYaNn7j)+F*dw^a6CTQMqxej7knq-dzJWFpd&-k zbjo6;mEOlJrWYhNJ#5I1#&p|Czham(RzZ?kdW31}OnS&LSzfXot79a&uY(KE!Uf&dG`W@gy}&8jo})BUIIGW@aH?As8HY z^0o@$(GBcSNRw$%O)Ak016P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8Pv)#tfssAeMCaij11@nlFc>~Nr8*>!Qe5~-TQe)Addu&WKn4>mkCYY^QKU<~h z!O(ilVpf2mm6gS`QYoE5v-o7G6jlY4M;N;2Fdy@>#oR>XJ z_rUD2G4ywc%7)g5)9Gl+Y-4#xG@6|6Gm^utt-gN3$m?_W+)TAqqKl+$4kr8RCx?XAYelGTwp zos>)NtWbu#f|7N`C9yNSHX0J0LSmr;o?lJQA`7`b9Lt2-5~+|FTp>H7>2!E?Gz68S z5lM?gJE9p~sz@vyZt2i3qHzny;&?l1M~9S%N7sj1!|71U6Y6YhHD544B(WnFkEUa* zL!F6uER%qvkY-$1x)m>KwYZLOG7{PIoscy*{mbIr!W!X69 ze}Sp+`VhU++wu*wJO(h?t#e~2mJEd>5wxIFW>=@8Es2CKMtXfL)7l=&B(%`_SlsIg zrSTr^SX-d_`06vN(D_5^am2%g8~)x|iU6+?h}u zZ`O^jqqpzUni*yY(M!2ez!WwlFNjr%5Z<^OYVC-I(Yay?F`{WMgEn8-s;LUopbf1- z%)_hK@#@}~*|Y&!I<_IpN?B-pAuvEd9*tbg;>fD3O{g8>b&%ufQiW5iLy5Ho#bfD^ zJ_16KL>$9Mj6gM*onU03XK7?atzCz12xY>nVPwIko%9}*Ar``DWjDgG?F_@g*n^M- q&C(7F!x>>2y}8=7msnAoAEIu|q7ydiDz+vPYhzIkg#}4WYX1ceYdVks literal 0 HcmV?d00001 diff --git a/c/gth_client_xml_parse.obj b/c/gth_client_xml_parse.obj new file mode 100644 index 0000000000000000000000000000000000000000..d41acd48da7e7a91e8b33dd45a60119e6bd06f6a GIT binary patch literal 17095 zcmcg!4R}=Ll|CUu7-EpoMvY3h7YY>+L;ipGlfNlJh$cY%r5%RMkPJ*_#>|ZTJYcay zig8M{TUOmxEB&!Ww^rLyMXNR-ZnTwWLF?*PpIuaRnI^XEHoKeJwCsD%H}{)+F9D4E zJbN`W?|skt&UeoDo$v1^m*sgb+V|w+EsH9NUL5&%80e3q4dC z2(C@GO)Gb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WR3QG#GC&%TZRPVoy9DLU)Gb`Op!W%`8)&ychk*_XD=z>&Bsd22us~Blw$CpDyp7~=y9}--%tJe?ID7Zl&Tklz*M+NsO zpvMH70D4@YJkUOYJ_9rW6rly6rv*9()GyFaU2fUc>%(u}LR3x7&8`yO^;AcFX{MOb z=H{1ublPUB_i_j+)%kc%)|Tph92N;W=W7)pRqx@jK+xg4I9~cE`hR7k#^Zw>o$dVD z;J)xnFdf}=8benxoz3)h57RFy$)zg0Tj-E`i=^w8_IOiv44_Asrq?qS-<53^O4d)jHA zhv}eZ57R|`9;Ta89;SyrTf=m@He(oY^L84 zakrVHTbQvejJk!H*~0K2QBJWfzwC&(+YJ9@;uM?tp(EnHjpUTdDuh(-^>dfvjErrp zJU(02b9COQ(c!{dTbQ@EF#q1d?84J#7sql#4I>u~oFmv8ev(A&@&1KQAIJ*xF)*vR zY(~y0Y98%jqzY&3xqlMvc5#@Z%TQT|fAySV_xf55^LiBnB zHDe&nc(`RuiWoSh`$z;Ve zb#=UGmRpS()l6n&QzIEJw&5J4z>;cOP0BdU(#>LlWY5tFcCQ(2#yRFPs85y+mMrS3 fIcs|=CpB$KWqs`!zkFata_wmq=2+E9sMG%dPEeoT literal 0 HcmV?d00001 diff --git a/c/install_start_script.obj b/c/install_start_script.obj new file mode 100644 index 0000000000000000000000000000000000000000..7a9ab26356b4e652f894b03413d8218bc398c7cd GIT binary patch literal 3824 zcmaJ^e{3699sjy9o@+envXn_sQY>w|H>hvA4b{;z;POXEA8_e{>h3J&Rpmrx)ddP?jFU6 z_!#BB#u)3roO$YEetK?t>eASW?A0$#%+8(YB%hwX{Kbpe%+(VN7U-Y2UdFXZk)ycL z#Mpe^5 zIAz{v*hM~X%$t_y>*cbB-t{%la81Wg+l3_>qw`1U1kpY8N%*U+QtO^I4cGSUlFv@f zo@P%wzF9H9VOk4p!mc=GnY)lb$ShkheQlBJ#WD7<#|l-mT+|kA&$sjn7gQo~pw@X2 z^;GUjcD@ATLiou`LP5salT+f*!A?1%*R{xd|sh^aA#4t-s|oj z6XVwzy4!#0c{``Z^+syxu7cNowYk@zU%zwy$3kWJ*K3*GAd|`k+4#(QetY(Bf~_}_ zYnjb@ZIk?arIRKb4Km4`B>tDfq?`@%$=NW3_*!PGUfZH-r=_JsOB7_bT9GD$?AA=E z6J5(Rg8Wv?2K+X1VGL`Tje2c^s>ha|k_*FA3h4y-#%z$;Q1MHp z_3ZXc(`v62*x2)UQ1aQ`;onO6;Qjx*o+7h&uFX1Dv$3AvoLvvyx6L86M!nYPUg?gk zqPH?zVqbO+Bfa`Nk+u95*6xYSX6*qiTae!fqQ7b1mwF?<^M@e2IfJQiN8{_6?baFw z9jVCkki3=oNbY?t9{DD}DIVc(ze}%+m&WpK3bM%{8aeW2GFAUiU-hXsfbK3MS&?HqrY#e8!{!Vl)pWJz&UW@nmYFf&K zPNg*@xw{mR%MfIC!^m+=KAMrxXIDsx5Ung*w5gK5#GQw zEYT;>$0h1T|A0g%(LX4Wcpc-#0*y)ZXC=CZ{uHiWJYz^&isAV|^swZ*1#rFe z1kj@rT>(-Nyatq(-0xdx8>mlmcYrwbD*;0F&Zng-%|bJUenm#3o`9mt@YKr6OFnGb8kT7c)vf?P4CM*E*SzLE7$OhA4_C z+ANO@(}P{i89LR)jL^AGW^{zaezn;dJx6n0%;WU!PUhS&J>S8M4h+$cx|m^lsl~Jx zu;PE+6A>k>C|f^tHYRXuHZd1AD5HrJ5;ny=6b^A$j5uv!Q_O{Mh`VB@_c71xV;1%? z)qTu!`KV6+8)Q7f!Alu6+I8K-R}kimMQ$wfBGNCHZGZHu3nOk-$N&HU literal 0 HcmV?d00001 diff --git a/c/map.obj b/c/map.obj new file mode 100644 index 0000000000000000000000000000000000000000..143e3582aa7489d1d26e257335a1303e09f13696 GIT binary patch literal 2260 zcma)7O>7%Q6du=Z2#cXkF;x6&6s6D}yor+*Dl2N;CLv7~HztYc0Y}^Q?l_*>`=gy* z(;y0^RwRPS0Yp)IKmw^3BqTThYCuITE#g8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)vEX2lv)NBFhG08bV zD$+8L^7{tRZaKSk3u8Nh+E`}|bpdh7jRSpNqAXA=P>9U|eNJ+VK$M#h`wo!u@hXt= zaTbVv(L?NKKtyhwh;o_eY>FNGtyadQ{GS0HpkG z#daybZ9poM^g*n$yBDZK>JH&Uq8KwWrNtYJjz9|=$_m|$?c4WyfW4@g`bz{7#aaS% zjc9E37YHm0GUpowFsi>iAW+EA^?};XH!hJ9TF1%b{r&q69w01be5QX-Gcz#R#Ps){ zZej-ZU1(YSAkzAHdiy$?n7*Dp%}if!jj6v7fyCPBN<=5* zpN~CGhpF0V&TlFuw4Z)cOr1DWOph;s_ZFr(uAMFvs~jgLW7MvIRLfvy+?E80GyHFsk{? zn?8ZJlKJHW%;g5=&lqW%Q7CF?hLzH?o|*QUth_2^{bA!sEEujzOZ66}2I>>l|CD9g z3x?UVUvqHpF|tM)sn%`RD>AJ~Zb-x3FzwlfyQrmeB0Z<2Eo;sYL%lFtz3niq@v4Kk J>Xf87`wxLmHwXX# literal 0 HcmV?d00001 diff --git a/c/record.obj b/c/record.obj new file mode 100644 index 0000000000000000000000000000000000000000..04a3c9e2cddea8debb6af3fbea88f2ad62386ede GIT binary patch literal 6014 zcma)Ae{37o9e-|IHyD??V79qo4FM_Ur59x=zMyeV@HJUvNd=3@~;N?z!_N zvlkD}l8WMVmEV9}SN6FYZp?(J)keXwWC1KkN_=OPZ< z*uQZ96!*i-hp;fVd3}G%(o0tVHr>(-Ma}5nVy4S^y*{;hi681CO} zmh_xvm#yg5zHL!`pO!D?^k~}5=>6$_#MLZiV&=dQThBHuWQ!P^$8N?7<73QwCX95+ zw9Kr{m-Q~^4;F1BZ#-rc_VUeUzG&q15{r#$BVRx52X$_i?PA&HS@^-T8d~Vx zYK)LXxfp}aB^h3))3UXa%{9J3MouqnPrFBf7=&h&ne4S+kVaY{Nte ziJ5wa%Zbn*Stwvnxlw@eq_ddLi+nWZ$YKV240$qH zmMvpNWG>HCR$v;QI$Ms6ZN$9{d9*P<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B7e98m;1&X{7AOWp|5pQS6HpgWgyn%^ zf;#|opWuEB)G5#}fbJ5b&j3j;UjUL`z6K;C*@b@<#h8&9A3MkBM@tjy%IcaOYi<3Z zkL{OC{m}>toHhCAaAfvXe=LF`gUsRC0_fEri6Hrqp+gb6-VW)sfp9I}xwW&iwS(M- zEp*qI&gKSYZ7c1OdYQFtR1>q9)x42eOR<iTJhCK8)V{Z=-oC;rlY4}R@>T4BeQO>foX5eH8O2>1GA>%NF&qvMkBNC ztp=u}^;{zp??KY*ZSH7G&SqNM+aGOYR<|Jkb+cOA*DPyfI%uy;nfjwLkfGQ(se4IgliS5pGW5;nUXtl|yLd`wa2BKH^?bUB zgD!FLn#{i0GL~IR=ZkeRDi|Cb)G-99;@nHF^)t7Nr(~X;#i$uWpCM>t#DLlmtc_nO1Lhn}h$`J#%;FbC9ZxsZ05Y&wTS6t73; zdaC7h#Ys%o>yF}l&y&^n8MZs3*{0!QbyTx(fa;A=mNk1uDf$JJ#tb1Wu*~$ZZg;JA zwcs#gq$}Pb6IVM?lbwP-s>-7doQ{gT;+RggaO#(XZKFn^y-l@>dfLbuX%rOB6w5`X z7EQ}C26AI+v82Pt46Gax2VSH^s#7(Uj$xQ8j{Vde9RjLx)}?|-m*F}NQ3mz&u$nf_ WVM8Zd-BUBB&OS1O7j=__IQt)V5>ws) literal 0 HcmV?d00001 diff --git a/c/save_to_pcap.obj b/c/save_to_pcap.obj new file mode 100644 index 0000000000000000000000000000000000000000..eab3088f4c3195efdf4c9b3b275e2a74f2ff0d35 GIT binary patch literal 20791 zcmbt+4Rl-8mF{t@7{^s=g}Nn_6fR6MO&Z&g{QncE^P~KfC^$bNori;vrE6QZEUCIz z`DtV7plCqcsFS|NElinLcx76q!z;9<5E#NsAjLr8O_=g#<@K>?s!n%^bJ;JlLF&fsxCG=^J5FgBu>p9V=tNZk& zqX|oN>_#DedaV#mKFO>@9Yyrs)7Ynt*@DEebXI&-nW<_`63`ETVSTb@c@`HLdk+ zQZ+S^3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s1;{t^;H#ErMp}ZunZ(_v<&}t9w3NzP`P`@O=IL$mjgX@DH2m zhd-vbIj(O+L+{Zm{7t)d2e$Z^P}zY-Cf10Aj(!)5*Z)qqXTSBr_uvW-ql|}pdp?ZB zKSKU&Ur!vNZ&9-2mb z%tM#Z@<-GQKef=Wp3k{I5%JHh7apMHb-DrY4#qw17^25L^b#U`l`xt_ zbtPa*-i#~-E?r}e|0A0d$#=Zr1Jc_}A0CoylPavl6v=jE%W+LeNs>(!*J94Pq?D;r akrczIFq%4rr<;Qxq|T|21=|jJa`*?R48Xzw literal 0 HcmV?d00001 diff --git a/c/version.obj b/c/version.obj new file mode 100644 index 0000000000000000000000000000000000000000..93c2a4791fd1489732b7ed411b203ca431c659ec GIT binary patch literal 614 zcmY*W%}T>S5S|!8@F3~~$WlBg(lo9A!9!|We;~EcKMw}VHW}O1CL5Bis33Up=0))0 z8+h{~UVIr}!6(pNYqkAgcD|X}nf>`3O^4UFm&T(8FbxA3evF>Dz~2xulH3o2p`V@w z!^d{NvsfFZo+Wu72EX2h*}saSt%TFrv&Ya<3m?C=&OW$LC2zJ#_am zVCQau$JnEypQQKe2Wh;dLDa*v$9;4?_d*U~JT!Rw3@q50gA~9N%*!KguHes?nHTef zp9->6T_%-Cuz+2&utN$wh*%F}b*E;HwEL{*6Dr6t`o!GKD z4FIQfRLNJ16|gI1&M0CccVkqW~!A2hffWJWboU#V+KrE!evGa*a5rW6{- zs5ZJR>6%hUVdbuQHehO1pRJ(ws969r(w3wRG7FNmI!v^>NPTGiJh;{6i3n+c@D0c0 Bc~bxY literal 0 HcmV?d00001 From eb631e8f626d5d4f6fca0b4483d9cdbcfe060d79 Mon Sep 17 00:00:00 2001 From: arashdalir Date: Thu, 23 Jul 2015 14:54:02 +0200 Subject: [PATCH 02/20] added -s argument -s allows the software to stop tracing after an interval (defined with -n duration) is ended. --- c/.gitignore | 209 ++++++ c/save_to_pcap.c | 1614 +++++++++++++++++++++++----------------------- 2 files changed, 1027 insertions(+), 796 deletions(-) diff --git a/c/.gitignore b/c/.gitignore index 5579800..942b144 100644 --- a/c/.gitignore +++ b/c/.gitignore @@ -16,3 +16,212 @@ save_to_pcap unmap wide_recorder version.c + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt \ No newline at end of file diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index f785c7c..faf88a6 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -72,21 +72,21 @@ typedef unsigned short u16; // PCap classic file format structures. #pragma pack(1) typedef struct { - u32 magic; - u16 major_version; - u16 minor_version; - u32 GMT_to_localtime; - u32 sigfigs; - u32 snaplen; - u32 network; + u32 magic; + u16 major_version; + u16 minor_version; + u32 GMT_to_localtime; + u32 sigfigs; + u32 snaplen; + u32 network; } PACK_SUFFIX PCap_classic_global_header; #pragma pack(1) typedef struct { - u32 ts_sec; - u32 ts_us; - u32 incl_len; - u32 orig_len; + u32 ts_sec; + u32 ts_us; + u32 incl_len; + u32 orig_len; } PACK_SUFFIX PCap_classic_packet_header; //-------------------------------------------------- @@ -94,38 +94,38 @@ typedef struct { #pragma pack(1) typedef struct { - u16 code; - u16 length; + u16 code; + u16 length; } PACK_SUFFIX PCap_NG_option; #pragma pack(1) typedef struct { - u32 type; - u32 block_total_length; - u32 byte_order_magic; - u16 major_version; - u16 minor_version; - unsigned long long section_length; + u32 type; + u32 block_total_length; + u32 byte_order_magic; + u16 major_version; + u16 minor_version; + unsigned long long section_length; } PACK_SUFFIX PCap_NG_shb; typedef struct { - u32 type; - u32 block_total_length; - u16 link_type; - u16 reserved; - u32 snaplen; + u32 type; + u32 block_total_length; + u16 link_type; + u16 reserved; + u32 snaplen; } PACK_SUFFIX PCap_NG_idb; #pragma pack(1) typedef struct { - u32 type; - u32 block_total_length; - u32 interface_id; - u32 timestamp_hi; - u32 timestamp_lo; - u32 captured_len; - u32 packet_len; + u32 type; + u32 block_total_length; + u32 interface_id; + u32 timestamp_hi; + u32 timestamp_lo; + u32 captured_len; + u32 packet_len; } PACK_SUFFIX PCap_NG_epb; // GTH socket structure. An SS7 MTP-2 signal unit can't be more than @@ -144,11 +144,11 @@ typedef struct { #define MAX_MTP2_CHANNELS 72 typedef struct { - u16 tag; - u16 flags; - u16 timestamp_hi; - u32 timestamp_lo; - char payload[MAX_SIGNAL_UNIT]; + u16 tag; + u16 flags; + u16 timestamp_hi; + u32 timestamp_lo; + char payload[MAX_SIGNAL_UNIT]; } GTH_mtp2; enum PCap_format { PCAP_CLASSIC, PCAP_NG }; @@ -157,62 +157,63 @@ enum PCap_format { PCAP_CLASSIC, PCAP_NG }; #define LINK_TYPE_MTP2 140 typedef struct { - char *span; - int timeslots[MAX_TIMESLOTS]; - int n_timeslots; + char *span; + int timeslots[MAX_TIMESLOTS]; + int n_timeslots; } Channel_t; //---------------------------------------------------------------------- void usage() { - fprintf(stderr, - "save_to_pcap git_head: %s build_hostname: %s\n\n" - - "save_to_pcap [...] " - "\n\nSave decoded MTP-2 signal units to a file in libpcap format, " - "\nsuitable for examining with wireshark, tshark or other network" - "\nanalyser software.\n" - "\n: [-c] [-f fisu=no] [-m] [-n ] [-v]" - "\n-c: save in the classic Pcap format (default is the newer Pcap-NG)" - "\n-f fisu=no: remove all MTP-2 FISUs" - "\n-f esnf=yes: use MTP-2 extended sequence numbers" - "\n-m: tells the GTH that you are using a -20dB monitor point" - "\n-n : rotate the output file after packets" - "\n-n : rotate the output file after seconds" - "\n-v: print API commands and responses (verbose)" - "\n" - "\n is the GTH's IP address or hostname" - "\n is a list of spans and timeslots:" - "\n [...] [...]" - "\n e.g. 1A 2A 1 2 3 monitors timeslots 1, 2 and 3 on span 1A and 2A." - "\n e.g. 1A 1 2A 2 3A 3 4 monitors timeslot 1 on 1A, 2 on 2A and 3 and 4 on 3A." - "\n can also be a range of timeslots for Nx64kbit/s signalling):" - "\n -[,-]" - "\n e.g. 1A 1-31 monitors one 1980kbit/s channel on timeslots 1-31" - "\n e.g. 1A 1-15,17-31 monitors one 1920kbit/s channel" - "\n e.g. 1A 1-4 1B 1-4 monitors two 256kbit/s channels" - "\n is the name of a span, e.g. '1A'" - "\n is a timeslot number, from 1 to 31" - "\n can be -, which means standard output.\n\n", - git_head, build_hostname); - - fprintf(stderr, - "Examples (on hardware with electrical E1/T1 ports):\n" - "./save_to_pcap 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" - "./save_to_pcap 172.16.1.10 1A 2A 3A 4A 1 2 3 4 isup_capture.pcapng\n" - "./save_to_pcap 172.16.1.10 1A 2A 16 1B 5 6 7 8 capture.pcapng\n" - "./save_to_pcap -m 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" - "./save_to_pcap -m -n packets:1000 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" - "./save_to_pcap -m -n duration:60 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" - "./save_to_pcap -c 172.16.1.10 1A 2A 16 - | tshark -V -i - \n" - "./save_to_pcap -c 172.16.1.10 1A 2A 16 - | wireshark -k -i - \n" - "./save_to_pcap -c 172.16.1.10 1A 2A 16 \\\\.\\pipe\\isup_capture.1\n"); - - fprintf(stderr, - "\nExamples (on SDH/SONET hardware, usually optical):\n" - "./save_to_pcap 172.16.1.10 pcm55 16 isup_capture.pcapng\n\n"); - - exit(-1); + fprintf(stderr, + "save_to_pcap git_head: %s build_hostname: %s\n\n" + + "save_to_pcap [...] " + "\n\nSave decoded MTP-2 signal units to a file in libpcap format, " + "\nsuitable for examining with wireshark, tshark or other network" + "\nanalyser software.\n" + "\n: [-c] [-f fisu=no] [-m] [-n ] [-v]" + "\n-c: save in the classic Pcap format (default is the newer Pcap-NG)" + "\n-f fisu=no: remove all MTP-2 FISUs" + "\n-f esnf=yes: use MTP-2 extended sequence numbers" + "\n-m: tells the GTH that you are using a -20dB monitor point" + "\n-n : rotate the output file after packets" + "\n-n : rotate the output file after seconds" + "\n-s Stop the process instead of rotating the files" + "\n-v: print API commands and responses (verbose)" + "\n" + "\n is the GTH's IP address or hostname" + "\n is a list of spans and timeslots:" + "\n [...] [...]" + "\n e.g. 1A 2A 1 2 3 monitors timeslots 1, 2 and 3 on span 1A and 2A." + "\n e.g. 1A 1 2A 2 3A 3 4 monitors timeslot 1 on 1A, 2 on 2A and 3 and 4 on 3A." + "\n can also be a range of timeslots for Nx64kbit/s signalling):" + "\n -[,-]" + "\n e.g. 1A 1-31 monitors one 1980kbit/s channel on timeslots 1-31" + "\n e.g. 1A 1-15,17-31 monitors one 1920kbit/s channel" + "\n e.g. 1A 1-4 1B 1-4 monitors two 256kbit/s channels" + "\n is the name of a span, e.g. '1A'" + "\n is a timeslot number, from 1 to 31" + "\n can be -, which means standard output.\n\n", + git_head, build_hostname); + + fprintf(stderr, + "Examples (on hardware with electrical E1/T1 ports):\n" + "./save_to_pcap 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" + "./save_to_pcap 172.16.1.10 1A 2A 3A 4A 1 2 3 4 isup_capture.pcapng\n" + "./save_to_pcap 172.16.1.10 1A 2A 16 1B 5 6 7 8 capture.pcapng\n" + "./save_to_pcap -m 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" + "./save_to_pcap -m -n packets:1000 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" + "./save_to_pcap -m -n duration:60 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" + "./save_to_pcap -c 172.16.1.10 1A 2A 16 - | tshark -V -i - \n" + "./save_to_pcap -c 172.16.1.10 1A 2A 16 - | wireshark -k -i - \n" + "./save_to_pcap -c 172.16.1.10 1A 2A 16 \\\\.\\pipe\\isup_capture.1\n"); + + fprintf(stderr, + "\nExamples (on SDH/SONET hardware, usually optical):\n" + "./save_to_pcap 172.16.1.10 pcm55 16 isup_capture.pcapng\n\n"); + + exit(-1); } //---------------------------------------------------------------------- @@ -225,24 +226,24 @@ usage() { #define fwrite write_to_handle_or_file static int write_to_handle_or_file(void *buffer, - int length, - int items, - HANDLE_OR_FILEPTR file) +int length, +int items, +HANDLE_OR_FILEPTR file) { - int result; - DWORD written; - - result = WriteFile(file, buffer, length * items, &written, 0); - if (written != length || !result ) { - return 0; - } - return 1; + int result; + DWORD written; + + result = WriteFile(file, buffer, length * items, &written, 0); + if (written != length || !result) { + return 0; + } + return 1; } static HANDLE_OR_FILEPTR stdout_handle_or_file() { - return GetStdHandle(STD_OUTPUT_HANDLE); + return GetStdHandle(STD_OUTPUT_HANDLE); } #define fclose CloseHandle @@ -251,7 +252,7 @@ stdout_handle_or_file() static HANDLE_OR_FILEPTR stdout_handle_or_file() { - return stdout; + return stdout; } #endif @@ -260,31 +261,31 @@ static HANDLE_OR_FILEPTR open_windows_pipe(const char *filename) { #ifdef WIN32 - HANDLE pipe; - int result; - - pipe = CreateNamedPipe(filename, - PIPE_ACCESS_OUTBOUND, // write-only - PIPE_TYPE_MESSAGE | PIPE_WAIT, // blocking writes - 1, // only allow one pipe - 70000, // write buffer. GTH max is 64k - 10000, // read buffer. We don't read - 0, // default timeout - 0); // no security attributes - - if (pipe == INVALID_HANDLE_VALUE) { - die("Unable to create a named pipe. Giving up."); - } - - result = ConnectNamedPipe(pipe, 0); - if (!result) { - die("Unabled to connect the named pipe. Giving up."); - } - - return pipe; + HANDLE pipe; + int result; + + pipe = CreateNamedPipe(filename, + PIPE_ACCESS_OUTBOUND, // write-only + PIPE_TYPE_MESSAGE | PIPE_WAIT, // blocking writes + 1, // only allow one pipe + 70000, // write buffer. GTH max is 64k + 10000, // read buffer. We don't read + 0, // default timeout + 0); // no security attributes + + if (pipe == INVALID_HANDLE_VALUE) { + die("Unable to create a named pipe. Giving up."); + } + + result = ConnectNamedPipe(pipe, 0); + if (!result) { + die("Unabled to connect the named pipe. Giving up."); + } + + return pipe; #else - die("Cannot open a windows named pipe on a non-windows OS. Giving up."); - return 0; + die("Cannot open a windows named pipe on a non-windows OS. Giving up."); + return 0; #endif } @@ -292,35 +293,35 @@ static void flush_file(HANDLE_OR_FILEPTR hf) { #ifdef WIN32 - FlushFileBuffers(hf); + FlushFileBuffers(hf); #else - fflush(hf); + fflush(hf); #endif } static void open_file_for_writing(HANDLE_OR_FILEPTR *hf, const char *filename) { - int result = 0; + int result = 0; #ifdef WIN32 - *hf = CreateFile(filename, - GENERIC_WRITE, - 0, - 0, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - 0); - - if (*hf == INVALID_HANDLE_VALUE) { - *hf = 0; - } + *hf = CreateFile(filename, + GENERIC_WRITE, + 0, + 0, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + 0); + + if (*hf == INVALID_HANDLE_VALUE) { + *hf = 0; + } #else - result = fopen_s(hf, filename, "wb"); + result = fopen_s(hf, filename, "wb"); #endif - if (*hf == 0 || result != 0) { - fprintf(stderr, "unable to open %s for writing. Aborting.\n", filename); - exit(-1); - } + if (*hf == 0 || result != 0) { + fprintf(stderr, "unable to open %s for writing. Aborting.\n", filename); + exit(-1); + } } //---------------------------------------------------------------------- @@ -328,74 +329,74 @@ open_file_for_writing(HANDLE_OR_FILEPTR *hf, const char *filename) // Optical E1/T1: just enable; no special options required. static void enable_optical_l1(GTH_api *api, - const char* span, - const int monitoring) +const char* span, +const int monitoring) { - int result; + int result; - if (monitoring) - fprintf(stderr, "Warning: ignoring -m switch on optical hardware.\n"); + if (monitoring) + fprintf(stderr, "Warning: ignoring -m switch on optical hardware.\n"); - result = gth_enable(api, span, 0, 0); + result = gth_enable(api, span, 0, 0); - if (result != 0) - die("Setting up L1 failed. (-v switch gives more information)"); + if (result != 0) + die("Setting up L1 failed. (-v switch gives more information)"); } // Electrical E1: disable TX pins and possibly enable -20dB monitoring static void enable_electrical_l1(GTH_api *api, - const char* span, - const int monitoring) +const char* span, +const int monitoring) { - int result; - char span_name[20]; + int result; + char span_name[20]; - int n_attributes = (monitoring)?3:2; - GTH_attribute attributes[] = { {"status", "enabled"}, - {"tx_enabled", "false"}, - {"monitoring", "true"} - }; + int n_attributes = (monitoring) ? 3 : 2; + GTH_attribute attributes[] = { { "status", "enabled" }, + { "tx_enabled", "false" }, + { "monitoring", "true" } + }; - assert(sizeof(span_name) > (strlen(span) + strlen("pcm"))); - strncpy_s(span_name, sizeof span_name, "pcm", sizeof span_name - 1); - strncat(span_name, span, sizeof span_name); + assert(sizeof(span_name) > (strlen(span) + strlen("pcm"))); + strncpy_s(span_name, sizeof span_name, "pcm", sizeof span_name - 1); + strncat(span_name, span, sizeof span_name); - // Use here: isn't supported until gth2_system_37a. - result = gth_set(api, span_name, attributes, n_attributes); + // Use here: isn't supported until gth2_system_37a. + result = gth_set(api, span_name, attributes, n_attributes); - if (result != 0) - die("Setting up L1 failed. (-v switch gives more information)"); + if (result != 0) + die("Setting up L1 failed. (-v switch gives more information)"); } // Start L1 for all channels. // This can cause an L1 to be started multiple times. That's OK. static void enable_l1(GTH_api *api, - const Channel_t channels[], - const int n_channels, - const int monitoring) +const Channel_t channels[], +const int n_channels, +const int monitoring) { - char architecture[10]; - int i; - int result; - - result = gth_query_resource_attribute(api, "board", "architecture", - architecture, 10); - if (result != 0) - die("Unable to query hardware architecture. Giving up."); - - architecture[3] = 0; - if (strcmp(architecture, "gth") == 0) { - for (i = 0; i < n_channels; i++) { - enable_electrical_l1(api, channels[i].span, monitoring); - } - } - else { - for (i = 0; i < n_channels; i++) { - enable_optical_l1(api, channels[i].span, monitoring); - } - } + char architecture[10]; + int i; + int result; + + result = gth_query_resource_attribute(api, "board", "architecture", + architecture, 10); + if (result != 0) + die("Unable to query hardware architecture. Giving up."); + + architecture[3] = 0; + if (strcmp(architecture, "gth") == 0) { + for (i = 0; i < n_channels; i++) { + enable_electrical_l1(api, channels[i].span, monitoring); + } + } + else { + for (i = 0; i < n_channels; i++) { + enable_optical_l1(api, channels[i].span, monitoring); + } + } } #define MAX_MTP2_ATTRS 2 @@ -403,88 +404,88 @@ enable_l1(GTH_api *api, // Start up MTP-2 monitoring on the given span and timeslot static void monitor_mtp2(GTH_api *api, - const Channel_t *channel, - int tag, - int drop_fisus, - int esnf, - int listen_port, - int listen_socket - ) +const Channel_t *channel, +int tag, +int drop_fisus, +int esnf, +int listen_port, +int listen_socket +) { - int result; - char job_id[MAX_JOB_ID]; - GTH_attribute attrs[MAX_MTP2_ATTRS]; - int n_attrs = 0; - - if (drop_fisus) { - attrs[n_attrs].key = "fisu"; - attrs[n_attrs].value = "no"; - n_attrs++; - } - - if (esnf) { - attrs[n_attrs].key = "esnf"; - attrs[n_attrs].value = "yes"; - n_attrs++; - } - - result = gth_new_mtp2_monitor_opt(api, tag, - channel->span, - channel->timeslots, - channel->n_timeslots, - job_id, api->my_ip, listen_port, - attrs, n_attrs); - if (result != 0) - die("Setting up MTP2 monitoring failed. (-v gives more information)"); - - return; + int result; + char job_id[MAX_JOB_ID]; + GTH_attribute attrs[MAX_MTP2_ATTRS]; + int n_attrs = 0; + + if (drop_fisus) { + attrs[n_attrs].key = "fisu"; + attrs[n_attrs].value = "no"; + n_attrs++; + } + + if (esnf) { + attrs[n_attrs].key = "esnf"; + attrs[n_attrs].value = "yes"; + n_attrs++; + } + + result = gth_new_mtp2_monitor_opt(api, tag, + channel->span, + channel->timeslots, + channel->n_timeslots, + job_id, api->my_ip, listen_port, + attrs, n_attrs); + if (result != 0) + die("Setting up MTP2 monitoring failed. (-v gives more information)"); + + return; } // Read exactly the requested number of bytes from the given descriptor void read_exact(int fd, char* buf, size_t count) { - size_t this_time; + size_t this_time; - while (count > 0) { - this_time = recv(fd, buf, count, 0); - if (this_time <= 0) - die("MTP-2 data socket from GTH unexpectedly closed\n"); + while (count > 0) { + this_time = recv(fd, buf, count, 0); + if (this_time <= 0) + die("MTP-2 data socket from GTH unexpectedly closed\n"); - count -= this_time; - buf += this_time; - } + count -= this_time; + buf += this_time; + } } void inline checked_fwrite(void *b, int n, HANDLE_OR_FILEPTR f) { - int result = fwrite(b, n, 1, f); + int result = fwrite(b, n, 1, f); - if (result != 1) { - die("fwrite failed. (Is the output file writeable?)"); - } + if (result != 1) { + die("fwrite failed. (Is the output file writeable?)"); + } } static void write_pcap_classic_header(HANDLE_OR_FILEPTR file) { - PCap_classic_global_header header; + PCap_classic_global_header header; - // The pcap file is native-endian, i.e. wireshark uses the magic value - // to figure out if it was created on a little-endian or big-endian machine. - header.magic = 0xa1b2c3d4; - header.major_version = 2; - header.minor_version = 4; - header.GMT_to_localtime = 0; - header.sigfigs = 0; - header.snaplen = 65535; - header.network = LINK_TYPE_MTP2; + // The pcap file is native-endian, i.e. wireshark uses the magic value + // to figure out if it was created on a little-endian or big-endian machine. + header.magic = 0xa1b2c3d4; + header.major_version = 2; + header.minor_version = 4; + header.GMT_to_localtime = 0; + header.sigfigs = 0; + header.snaplen = 65535; + header.network = LINK_TYPE_MTP2; - checked_fwrite((void*)&header, sizeof header, file); + checked_fwrite((void*)&header, sizeof header, file); - return; + return; } // Must be a multiple of 4 because of padding rules in PCap-ng @@ -494,55 +495,55 @@ char hw_description[MAX_HW_DESCRIPTION]; void read_hw_description(GTH_api *api, const char *hostname) { - int result; - char architecture[10]; - - result = gth_query_resource_attribute(api, "board", "architecture", - architecture, 10); - if (result != 0) - die("Unable to query hardware architecture. Giving up."); - - result = snprintf(hw_description, MAX_HW_DESCRIPTION, - "save_to_pcap (Corelatus %s %s)", - architecture, hostname); - if (result >= MAX_HW_DESCRIPTION) - die("Hardware description is too long"); + int result; + char architecture[10]; + + result = gth_query_resource_attribute(api, "board", "architecture", + architecture, 10); + if (result != 0) + die("Unable to query hardware architecture. Giving up."); + + result = snprintf(hw_description, MAX_HW_DESCRIPTION, + "save_to_pcap (Corelatus %s %s)", + architecture, hostname); + if (result >= MAX_HW_DESCRIPTION) + die("Hardware description is too long"); } static int inline round_up_32_bit(int x) { - return (x + 3) & (~3); + return (x + 3) & (~3); } static void write_pcap_ng_shb(HANDLE_OR_FILEPTR file) { - PCap_NG_shb shb; - u32 btl; - PCap_NG_option userappl = {4, 0}; // 4 = user application name - PCap_NG_option end_of_options = {0, 0}; - userappl.length = strlen(hw_description); - - btl = sizeof(PCap_NG_shb) - + sizeof(userappl) + round_up_32_bit(userappl.length) - + sizeof(end_of_options) - + sizeof(shb.block_total_length); - - shb.type = 0x0A0D0D0A; - shb.block_total_length = btl; - shb.byte_order_magic = 0x1A2B3C4D; - shb.major_version = 1; - shb.minor_version = 0; - shb.section_length = 0xffffffffFFFFFFFFULL; // "unknown" - - checked_fwrite((void*)&shb, sizeof shb, file); - checked_fwrite((void*)&userappl, sizeof userappl, file); - checked_fwrite((void*)hw_description, round_up_32_bit(userappl.length), file); - checked_fwrite((void*)&end_of_options, sizeof end_of_options, file); - checked_fwrite((void*)&btl, sizeof(btl), file); - - return; + PCap_NG_shb shb; + u32 btl; + PCap_NG_option userappl = { 4, 0 }; // 4 = user application name + PCap_NG_option end_of_options = { 0, 0 }; + userappl.length = strlen(hw_description); + + btl = sizeof(PCap_NG_shb) + + sizeof(userappl) + round_up_32_bit(userappl.length) + + sizeof(end_of_options) + + sizeof(shb.block_total_length); + + shb.type = 0x0A0D0D0A; + shb.block_total_length = btl; + shb.byte_order_magic = 0x1A2B3C4D; + shb.major_version = 1; + shb.minor_version = 0; + shb.section_length = 0xffffffffFFFFFFFFULL; // "unknown" + + checked_fwrite((void*)&shb, sizeof shb, file); + checked_fwrite((void*)&userappl, sizeof userappl, file); + checked_fwrite((void*)hw_description, round_up_32_bit(userappl.length), file); + checked_fwrite((void*)&end_of_options, sizeof end_of_options, file); + checked_fwrite((void*)&btl, sizeof(btl), file); + + return; } // Must be a multiple of 4 because of padding rules in PCap-ng @@ -553,161 +554,161 @@ write_pcap_ng_shb(HANDLE_OR_FILEPTR file) static void write_pcap_idbs(HANDLE_OR_FILEPTR file, Channel_t *c, int n) { - int x; - PCap_NG_option end_of_options = {0, 0}; + int x; + PCap_NG_option end_of_options = { 0, 0 }; - for (x = 0; x < n; x++) { - PCap_NG_idb idb; - PCap_NG_option if_name; - char idb_if_name[MAX_IF_NAME]; - PCap_NG_option if_tsresol; - char tsresol[4] = {3, 0, 0, 0}; // 10^-3 resolution, three padding bytes + for (x = 0; x < n; x++) { + PCap_NG_idb idb; + PCap_NG_option if_name; + char idb_if_name[MAX_IF_NAME]; + PCap_NG_option if_tsresol; + char tsresol[4] = { 3, 0, 0, 0 }; // 10^-3 resolution, three padding bytes - u32 block_total_length; + u32 block_total_length; - if_name.code = 2; // if_name - if_name.length = snprintf(idb_if_name, MAX_IF_NAME, "%s:%d", - c[x].span, c[x].timeslots[0]); - if (if_name.length < 0 || if_name.length >= MAX_IF_NAME) - die("interface name is too long"); + if_name.code = 2; // if_name + if_name.length = snprintf(idb_if_name, MAX_IF_NAME, "%s:%d", + c[x].span, c[x].timeslots[0]); + if (if_name.length < 0 || if_name.length >= MAX_IF_NAME) + die("interface name is too long"); - block_total_length = sizeof(idb) - + sizeof(PCap_NG_option) + round_up_32_bit(if_name.length) - + sizeof(PCap_NG_option) + sizeof(tsresol) - + sizeof(PCap_NG_option) - + sizeof(block_total_length); + block_total_length = sizeof(idb) + + sizeof(PCap_NG_option) + round_up_32_bit(if_name.length) + + sizeof(PCap_NG_option) + sizeof(tsresol) + + sizeof(PCap_NG_option) + + sizeof(block_total_length); - idb.type = 1; - idb.block_total_length = block_total_length; - idb.link_type = LINK_TYPE_MTP2; - idb.reserved = 0; - idb.snaplen = 279; + idb.type = 1; + idb.block_total_length = block_total_length; + idb.link_type = LINK_TYPE_MTP2; + idb.reserved = 0; + idb.snaplen = 279; - if_tsresol.code = 9; // tsresol - if_tsresol.length = 1; + if_tsresol.code = 9; // tsresol + if_tsresol.length = 1; - checked_fwrite((void*)&idb, sizeof(idb), file); + checked_fwrite((void*)&idb, sizeof(idb), file); - checked_fwrite((void*)&if_name, sizeof (if_name), file); - checked_fwrite((void*)&idb_if_name, round_up_32_bit(if_name.length), file); + checked_fwrite((void*)&if_name, sizeof(if_name), file); + checked_fwrite((void*)&idb_if_name, round_up_32_bit(if_name.length), file); - checked_fwrite((void*)&if_tsresol, sizeof(if_tsresol), file); - checked_fwrite((void*)&tsresol, sizeof(tsresol), file); + checked_fwrite((void*)&if_tsresol, sizeof(if_tsresol), file); + checked_fwrite((void*)&tsresol, sizeof(tsresol), file); - checked_fwrite((void*)&end_of_options, sizeof(end_of_options), file); + checked_fwrite((void*)&end_of_options, sizeof(end_of_options), file); - checked_fwrite((void*)&block_total_length, sizeof block_total_length, file); - } + checked_fwrite((void*)&block_total_length, sizeof block_total_length, file); + } } static void write_pcap_global_header(HANDLE_OR_FILEPTR file, - enum PCap_format format, - Channel_t *channels, - int n_channels) +enum PCap_format format, + Channel_t *channels, + int n_channels) { - switch (format) { - case PCAP_CLASSIC: - write_pcap_classic_header(file); - break; - - case PCAP_NG: - write_pcap_ng_shb(file); - write_pcap_idbs(file, channels, n_channels); - break; - - default: die("internal error writing global pcap header"); - } + switch (format) { + case PCAP_CLASSIC: + write_pcap_classic_header(file); + break; + + case PCAP_NG: + write_pcap_ng_shb(file); + write_pcap_idbs(file, channels, n_channels); + break; + + default: die("internal error writing global pcap header"); + } } static void write_classic_packet_header(HANDLE_OR_FILEPTR file, - u32 timestamp_hi, - u32 timestamp_lo, - int length) + u32 timestamp_hi, + u32 timestamp_lo, + int length) { - PCap_classic_packet_header pcap_header; - unsigned long long ts_sec; - unsigned long long ts_us; - int result; + PCap_classic_packet_header pcap_header; + unsigned long long ts_sec; + unsigned long long ts_us; + int result; - assert(sizeof ts_sec == 8); + assert(sizeof ts_sec == 8); - ts_us = timestamp_hi; - ts_us <<= 32; - ts_us += timestamp_lo; + ts_us = timestamp_hi; + ts_us <<= 32; + ts_us += timestamp_lo; - ts_sec = ts_us / 1000; - ts_us = (ts_us % 1000) * 1000; + ts_sec = ts_us / 1000; + ts_us = (ts_us % 1000) * 1000; - pcap_header.ts_sec = (u32)ts_sec; - pcap_header.ts_us = (u32)ts_us; - pcap_header.incl_len = length; - pcap_header.orig_len = length; + pcap_header.ts_sec = (u32)ts_sec; + pcap_header.ts_us = (u32)ts_us; + pcap_header.incl_len = length; + pcap_header.orig_len = length; - result = fwrite(&pcap_header, sizeof pcap_header, 1, file); - if (result != 1) { - die("Unable to write packet to the given file. (Is it writeable?)"); - } + result = fwrite(&pcap_header, sizeof pcap_header, 1, file); + if (result != 1) { + die("Unable to write packet to the given file. (Is it writeable?)"); + } } static u32 write_ng_packet_header(HANDLE_OR_FILEPTR file, - u32 timestamp_hi, - u32 timestamp_lo, - u16 tag, - int length) +u32 timestamp_hi, +u32 timestamp_lo, +u16 tag, +int length) { - PCap_NG_epb epb; + PCap_NG_epb epb; - epb.type = 6; - epb.block_total_length = sizeof(epb) - + round_up_32_bit(length) - + sizeof(epb.block_total_length); - epb.interface_id = tag; - epb.timestamp_hi = timestamp_hi; - epb.timestamp_lo = timestamp_lo; - epb.captured_len = length; - epb.packet_len = length; + epb.type = 6; + epb.block_total_length = sizeof(epb) + + round_up_32_bit(length) + + sizeof(epb.block_total_length); + epb.interface_id = tag; + epb.timestamp_hi = timestamp_hi; + epb.timestamp_lo = timestamp_lo; + epb.captured_len = length; + epb.packet_len = length; - checked_fwrite(&epb, sizeof epb, file); + checked_fwrite(&epb, sizeof epb, file); - return epb.block_total_length; + return epb.block_total_length; } static inline void write_packet(HANDLE_OR_FILEPTR file, - u32 timestamp_hi, - u32 timestamp_lo, - u16 tag, - void *payload, - int length, - int format) +u32 timestamp_hi, +u32 timestamp_lo, +u16 tag, +void *payload, +int length, +int format) { - u32 total_length; - - switch (format) { - case PCAP_CLASSIC: - write_classic_packet_header(file, timestamp_hi, timestamp_lo, length); - checked_fwrite(payload, length, file); - break; - - case PCAP_NG: - total_length = write_ng_packet_header(file, timestamp_hi, - timestamp_lo, tag, length); - checked_fwrite(payload, round_up_32_bit(length), file); - checked_fwrite(&total_length, sizeof total_length, file); - break; - - default: - die("internal error"); - } + u32 total_length; + + switch (format) { + case PCAP_CLASSIC: + write_classic_packet_header(file, timestamp_hi, timestamp_lo, length); + checked_fwrite(payload, length, file); + break; + + case PCAP_NG: + total_length = write_ng_packet_header(file, timestamp_hi, + timestamp_lo, tag, length); + checked_fwrite(payload, round_up_32_bit(length), file); + checked_fwrite(&total_length, sizeof total_length, file); + break; + + default: + die("internal error"); + } } static int is_filename_a_pipe(const char *name) { - const char pipe_prefix[] = "\\\\.\\pipe\\"; - return (strncmp(pipe_prefix, name, strlen(pipe_prefix)) == 0); + const char pipe_prefix[] = "\\\\.\\pipe\\"; + return (strncmp(pipe_prefix, name, strlen(pipe_prefix)) == 0); } // windows.h has a max() function. On *nix, sys/param.h has a MAX macro @@ -715,7 +716,7 @@ is_filename_a_pipe(const char *name) static int max_arg(int a, int b) { - return (a > b)?a:b; + return (a > b) ? a : b; } @@ -725,40 +726,40 @@ max_arg(int a, int b) static int wait_for_packet(GTH_api *api, int data_socket) { - fd_set fds; - int result; - int nfds = max_arg(api->fd, data_socket) + 1; + fd_set fds; + int result; + int nfds = max_arg(api->fd, data_socket) + 1; - FD_ZERO(&fds); + FD_ZERO(&fds); - for (;;) - { - struct timeval tv = {1, 0}; - FD_SET(api->fd, &fds); - FD_SET(data_socket, &fds); - - result = select(nfds, &fds, 0, 0, &tv); - - if (result < 0) + for (;;) { - die("internal error---select() returned error"); + struct timeval tv = { 1, 0 }; + FD_SET(api->fd, &fds); + FD_SET(data_socket, &fds); + + result = select(nfds, &fds, 0, 0, &tv); + + if (result < 0) + { + die("internal error---select() returned error"); + } + + if (result == 0) + { + return 0; + } + + if (FD_ISSET(api->fd, &fds)) + { + gth_nop(api); + } + + if (FD_ISSET(data_socket, &fds)) + { + return 1; + } } - - if (result == 0) - { - return 0; - } - - if (FD_ISSET(api->fd, &fds)) - { - gth_nop(api); - } - - if (FD_ISSET(data_socket, &fds)) - { - return 1; - } - } } // Timers are totally different on Windows and the Unixes. We just @@ -769,23 +770,23 @@ static HANDLE timer; static void set_timer(int seconds) { - LARGE_INTEGER liDueTime; - int result; + LARGE_INTEGER liDueTime; + int result; - liDueTime.QuadPart = seconds; - // Timer is in 100ns units. Negative means relative timeout. - liDueTime.QuadPart *= -10000000LL; + liDueTime.QuadPart = seconds; + // Timer is in 100ns units. Negative means relative timeout. + liDueTime.QuadPart *= -10000000LL; - result = SetWaitableTimer(timer, &liDueTime, 0, NULL, NULL, 0); - if (!result) die("SetWaitableTimer failed"); + result = SetWaitableTimer(timer, &liDueTime, 0, NULL, NULL, 0); + if (!result) die("SetWaitableTimer failed"); } static void init_timer(int seconds) { - timer = CreateWaitableTimer(NULL, TRUE, "file_rotation_timer"); - if (timer == NULL) die("CreateWaitableTimer failed"); - set_timer(seconds); + timer = CreateWaitableTimer(NULL, TRUE, "file_rotation_timer"); + if (timer == NULL) die("CreateWaitableTimer failed"); + set_timer(seconds); } // Return: 0 if the timer has expired @@ -793,12 +794,12 @@ static int read_and_restart_timer(int seconds) { - if (WaitForSingleObject(timer, 0) == WAIT_OBJECT_0) - { - set_timer(seconds); - return 0; - } - return 1; + if (WaitForSingleObject(timer, 0) == WAIT_OBJECT_0) + { + set_timer(seconds); + return 0; + } + return 1; } @@ -808,55 +809,55 @@ static timer_t timer; static void set_timer(int seconds) { - int result; - struct itimerspec new_timer = { {0, 0}, {seconds, 0} }; + int result; + struct itimerspec new_timer = { { 0, 0 }, { seconds, 0 } }; - result = timer_settime(timer, 0, &new_timer, 0); - if (result != 0) die("timer_settime failed"); + result = timer_settime(timer, 0, &new_timer, 0); + if (result != 0) die("timer_settime failed"); } static void init_timer(int seconds) { - int result; - struct sigevent se; + int result; + struct sigevent se; - se.sigev_notify = SIGEV_NONE; + se.sigev_notify = SIGEV_NONE; - result = timer_create(CLOCK_REALTIME, &se, &timer); - if (result != 0) die("unable to create a timer"); + result = timer_create(CLOCK_REALTIME, &se, &timer); + if (result != 0) die("unable to create a timer"); - set_timer(seconds); + set_timer(seconds); } // Return: 0 if the timer has expired static int read_and_restart_timer(int seconds) { - int result; - struct itimerspec current; + int result; + struct itimerspec current; - result = timer_gettime(timer, ¤t); - if (result != 0) die("timer_gettime() failed"); + result = timer_gettime(timer, ¤t); + if (result != 0) die("timer_gettime() failed"); - if (current.it_value.tv_sec == 0 && current.it_value.tv_nsec == 0) - { - set_timer(seconds); - return 0; - } + if (current.it_value.tv_sec == 0 && current.it_value.tv_nsec == 0) + { + set_timer(seconds); + return 0; + } - return 1; + return 1; } #endif static inline int is_time_to_rotate(int su_count, int n_sus_per_file, int duration) { - if (duration > 0 && read_and_restart_timer(duration) == 0) - { - return 1; - } - return (n_sus_per_file > 0 && (su_count >= n_sus_per_file)); + if (duration > 0 && read_and_restart_timer(duration) == 0) + { + return 1; + } + return (n_sus_per_file > 0 && (su_count >= n_sus_per_file)); } #define MAX_FILENAME 100 @@ -864,108 +865,125 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) // Loop forever, converting the incoming GTH data to libpcap format static void convert_to_pcap(GTH_api *api, - int data_socket, - const char *base_name, - const int n_sus_per_file, - const int duration_per_file, - Channel_t channels[], - int n_channels, - const enum PCap_format format) +int data_socket, +const char *base_name, +const int n_sus_per_file, +const int duration_per_file, +const int stop_after_interval, +Channel_t channels[], +int n_channels, +const enum PCap_format format) { - u16 length; - GTH_mtp2 signal_unit; - int su_count; - int file_number = 1; - HANDLE_OR_FILEPTR file; - int write_to_stdout = 0; - int write_to_pipe; - - write_to_stdout = (strcmp(base_name, "-") == 0); - write_to_pipe = is_filename_a_pipe(base_name); - - init_timer(duration_per_file); - - while (1) { - char filename[MAX_FILENAME]; - - if (!write_to_stdout && !write_to_pipe) - { - snprintf(filename, MAX_FILENAME, "%s.%d", - base_name, file_number); - open_file_for_writing(&file, filename); - fprintf(stderr, "saving to file %s\n", filename); - } - else if (write_to_stdout) - { - file = stdout_handle_or_file(); - fprintf(stderr, "saving capture to stdout\n"); - } - else - { - fprintf(stderr, "saving capture to a windows named pipe\n"); - file = open_windows_pipe(base_name); - } - - write_pcap_global_header(file, format, channels, n_channels); - - file_number++; - su_count = 0; - - do - { - if (wait_for_packet(api, data_socket) != 0) - { - read_exact(data_socket, (void*)&length, sizeof length); - length = ntohs(length); - assert(length <= sizeof signal_unit); - read_exact(data_socket, (void*)&signal_unit, length); - - length -= (signal_unit.payload - (char*)&(signal_unit.tag)); - write_packet(file, - ntohs(signal_unit.timestamp_hi), - ntohl(signal_unit.timestamp_lo), - ntohs(signal_unit.tag), - signal_unit.payload, - length, - format); - flush_file(file); - su_count++; - } - } - while ( !is_time_to_rotate(su_count, n_sus_per_file, duration_per_file) - || write_to_pipe - || write_to_stdout ); - - fclose(file); - } + u16 length; + GTH_mtp2 signal_unit; + int su_count; + int file_number = 1; + HANDLE_OR_FILEPTR file; + int write_to_stdout = 0; + int write_to_pipe; + + write_to_stdout = (strcmp(base_name, "-") == 0); + write_to_pipe = is_filename_a_pipe(base_name); + + init_timer(duration_per_file); + + int always_true = 1; + + while (always_true) { + char filename[MAX_FILENAME]; + + if (!write_to_stdout && !write_to_pipe) + { + if (!stop_after_interval) + { + snprintf(filename, MAX_FILENAME, "%s.%d", + base_name, file_number); + } + else + { + snprintf(filename, MAX_FILENAME, "%s", + base_name); + + } + open_file_for_writing(&file, filename); + fprintf(stderr, "saving to file %s\n", filename); + } + else if (write_to_stdout) + { + file = stdout_handle_or_file(); + fprintf(stderr, "saving capture to stdout\n"); + } + else + { + fprintf(stderr, "saving capture to a windows named pipe\n"); + file = open_windows_pipe(base_name); + } + + write_pcap_global_header(file, format, channels, n_channels); + + file_number++; + su_count = 0; + + int rotation_time_reached = 0; + do + { + if (wait_for_packet(api, data_socket) != 0) + { + read_exact(data_socket, (void*)&length, sizeof length); + length = ntohs(length); + assert(length <= sizeof signal_unit); + read_exact(data_socket, (void*)&signal_unit, length); + + length -= (signal_unit.payload - (char*)&(signal_unit.tag)); + write_packet(file, + ntohs(signal_unit.timestamp_hi), + ntohl(signal_unit.timestamp_lo), + ntohs(signal_unit.tag), + signal_unit.payload, + length, + format); + flush_file(file); + su_count++; + } + } while (!(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) + || write_to_pipe + || write_to_stdout); + + if (rotation_time_reached && stop_after_interval) + { + fprintf(stderr, "Stopped capturing when rotation time reached\n"); + always_true = 0; + } + fclose(file); + } } static int is_span_name(char *arg) { - if (strstr(arg, "pcm")) return 1; // Optical hardware uses e.g. 'pcm55' - if (strstr(arg, "A")) return 1; - if (strstr(arg, "B")) return 1; - if (strstr(arg, "C")) return 1; - if (strstr(arg, "D")) return 1; - return 0; + if (strstr(arg, "pcm")) return 1; // Optical hardware uses e.g. 'pcm55' + if (strstr(arg, "A")) return 1; + if (strstr(arg, "B")) return 1; + if (strstr(arg, "C")) return 1; + if (strstr(arg, "D")) return 1; + return 0; } static void print_channels(Channel_t *channels, int n) { - int x; - int y; - - for (x = 0; x < n; x++) { - fprintf(stderr, "monitoring %s:", channels->span); - for (y = 0; y < channels->n_timeslots-1; y++) { - fprintf(stderr, "%d,", channels->timeslots[y]); - } - fprintf(stderr, "%d ", channels->timeslots[y]); - fprintf(stderr, "interface_id=%d\n", x); - channels++; - } + int x; + int y; + + for (x = 0; x < n; x++) { + fprintf(stderr, "monitoring %s:", channels->span); + for (y = 0; y < channels->n_timeslots - 1; y++) { + fprintf(stderr, "%d,", channels->timeslots[y]); + } + fprintf(stderr, "%d ", channels->timeslots[y]); + fprintf(stderr, "interface_id=%d\n", x); + channels++; + } } // Examples of arguments "16", "1-3", "1-3,5-9,10", "1,2,3" @@ -976,79 +994,78 @@ print_channels(Channel_t *channels, int n) static void argument_to_ts_array(const char* s, int timeslots[], int *n_timeslots) { - char ranges[MAX_TIMESLOTS][MAX_RANGE]; // Longest-possible - int range = 0; - char *pos; - int i; - - *n_timeslots = 0; - - while ( (pos = strchr(s, ',')) ) - { - strncpy_s(ranges[range++], MAX_RANGE, s, pos-s); - s = pos + 1; - if (range > MAX_TIMESLOTS) - die("Too many timeslots specified. Abort."); - } - strncpy_s(ranges[range++], MAX_RANGE, s, strlen(s)); - - for (i = 0; i < range; i++) - { - int lo; - int hi; - int result; - - result = sscanf(ranges[i], "%d-%d", &lo, &hi); - - if (result == 0) - { - fprintf(stderr, "Got %s", ranges[i]); - die(" when expecting a timeslot. Abort."); - } + char ranges[MAX_TIMESLOTS][MAX_RANGE]; // Longest-possible + int range = 0; + char *pos; + int i; - if (result == 1) - hi = lo; + *n_timeslots = 0; - if (lo > hi) + while ((pos = strchr(s, ','))) { - fprintf(stderr, "timeslot range %s in unexpected format.", ranges[i]); - die("Abort."); + strncpy_s(ranges[range++], MAX_RANGE, s, pos - s); + s = pos + 1; + if (range > MAX_TIMESLOTS) + die("Too many timeslots specified. Abort."); } + strncpy_s(ranges[range++], MAX_RANGE, s, strlen(s)); - if (lo < 1 || hi > 31) - die("Timeslot outside expected range 1..31. Abort."); - - do + for (i = 0; i < range; i++) { - timeslots[(*n_timeslots)++] = lo++; + int lo; + int hi; + int result; + + result = sscanf(ranges[i], "%d-%d", &lo, &hi); + + if (result == 0) + { + fprintf(stderr, "Got %s", ranges[i]); + die(" when expecting a timeslot. Abort."); + } + + if (result == 1) + hi = lo; + + if (lo > hi) + { + fprintf(stderr, "timeslot range %s in unexpected format.", ranges[i]); + die("Abort."); + } + + if (lo < 1 || hi > 31) + die("Timeslot outside expected range 1..31. Abort."); + + do + { + timeslots[(*n_timeslots)++] = lo++; + } while (lo <= hi); } - while (lo <= hi); - } } static void check_for_overlapping_channels(Channel_t *channels, int n_channels) { - int i; - int j; - int k; - int l; - - for (i = 0; i < n_channels; i++) - for (j = i+1; j < n_channels; j++) - { - if (channels[i].span == channels[j].span) - { - for (k = 0; k < channels[i].n_timeslots; k++) - for (l = 0; l < channels[j].n_timeslots; l++) - if (channels[i].timeslots[k] == channels[j].timeslots[l]) - { - fprintf(stderr, "Input %s:%d was specified twice. ", - channels[i].span, channels[i].timeslots[k]); - die("Abort."); - } - } - } + int i; + int j; + int k; + int l; + + for (i = 0; i < n_channels; i++) + for (j = i + 1; j < n_channels; j++) + { + if (channels[i].span == channels[j].span) + { + for (k = 0; k < channels[i].n_timeslots; k++) + for (l = 0; l < channels[j].n_timeslots; l++) + if (channels[i].timeslots[k] == channels[j].timeslots[l]) + { + fprintf(stderr, "Input %s:%d was specified twice. ", + channels[i].span, channels[i].timeslots[k]); + die("Abort."); + } + } + } } @@ -1057,61 +1074,61 @@ check_for_overlapping_channels(Channel_t *channels, int n_channels) // Return the number of arguments consumed static int arguments_to_channels(int argc, - char **argv, - Channel_t *channels, - int *n_channels) +char **argv, +Channel_t *channels, +int *n_channels) { - char *spans[MAX_SPANS]; - int n_spans = 0; + char *spans[MAX_SPANS]; + int n_spans = 0; - int timeslots[MAX_TIMESLOTS]; - int n_timeslots; + int timeslots[MAX_TIMESLOTS]; + int n_timeslots; - int current_arg = 0; + int current_arg = 0; - int i; + int i; - if (!is_span_name(argv[current_arg])) - die("Must specify at least one E1/T1 interface, e.g. '1A'. Abort."); + if (!is_span_name(argv[current_arg])) + die("Must specify at least one E1/T1 interface, e.g. '1A'. Abort."); - while (current_arg < argc - 1) - { - if (is_span_name(argv[current_arg])) - { - if (n_timeslots > 0) // We are starting a new span group - { - n_spans = 0; - n_timeslots = 0; - } - spans[n_spans++] = argv[current_arg]; - if (n_spans > MAX_SPANS) - die("Too many interfaces given"); - } - else // We're now processing either timeslots or timeslot ranges + while (current_arg < argc - 1) { - if (n_spans == 0) - die("Expected E1/T1 interface before further arguments. Abort."); - - argument_to_ts_array(argv[current_arg], timeslots, &n_timeslots); - - for (i = 0; i < n_spans; i++) - { - if (*n_channels >= MAX_MTP2_CHANNELS) - die("Attempted to start too many signalling channels. Abort."); - - channels[*n_channels].span = spans[i]; - channels[*n_channels].n_timeslots = n_timeslots; - memcpy(channels[*n_channels].timeslots, timeslots, - sizeof timeslots); - (*n_channels)++; - } + if (is_span_name(argv[current_arg])) + { + if (n_timeslots > 0) // We are starting a new span group + { + n_spans = 0; + n_timeslots = 0; + } + spans[n_spans++] = argv[current_arg]; + if (n_spans > MAX_SPANS) + die("Too many interfaces given"); + } + else // We're now processing either timeslots or timeslot ranges + { + if (n_spans == 0) + die("Expected E1/T1 interface before further arguments. Abort."); + + argument_to_ts_array(argv[current_arg], timeslots, &n_timeslots); + + for (i = 0; i < n_spans; i++) + { + if (*n_channels >= MAX_MTP2_CHANNELS) + die("Attempted to start too many signalling channels. Abort."); + + channels[*n_channels].span = spans[i]; + channels[*n_channels].n_timeslots = n_timeslots; + memcpy(channels[*n_channels].timeslots, timeslots, + sizeof timeslots); + (*n_channels)++; + } + } + current_arg++; } - current_arg++; - } - check_for_overlapping_channels(channels, *n_channels); + check_for_overlapping_channels(channels, *n_channels); - return current_arg; + return current_arg; } // Two possible rotation syntaxes. @@ -1125,152 +1142,157 @@ arguments_to_channels(int argc, void static parse_rotation(char *arg, int *n_sus_per_file, int *duration_per_file) { - int n; - - if (sscanf(arg, "packets:%d", &n) == 1 - || sscanf(arg, "%d", &n) == 1) - { - *n_sus_per_file = n; - return; - } - - if (sscanf(arg, "duration:%d", &n) == 1) - { - *duration_per_file = n; - return; - } - - usage(); -} - + int n; -void static -process_arguments(char **argv, - int argc, - int *monitoring, - int *verbose, - int *n_sus_per_file, - int *duration_per_file, - int *drop_fisus, - int *esnf, - char **hostname, - Channel_t channels[], - int *n_channels, - char **base_filename, - enum PCap_format *format) -{ - int current_arg; + if (sscanf(arg, "packets:%d", &n) == 1 + || sscanf(arg, "%d", &n) == 1) + { + *n_sus_per_file = n; + return; + } - while (argc > 1 && argv[1][0] == '-') { - switch (argv[1][1]) { - case 'c': *format = PCAP_CLASSIC; break; + if (sscanf(arg, "duration:%d", &n) == 1) + { + *duration_per_file = n; + return; + } - case 'f': - if (argc < 3) { usage(); - } - if (!strcmp("fisu=no", argv[2])) { - *drop_fisus = 1; - } else if (!strcmp("esnf=yes", argv[2])) { - *esnf = 1; - } - argc--; - argv++; - break; - - case 'm': *monitoring = 1; break; - - case 'n': - if (argc < 3) { - usage(); - } - parse_rotation(argv[2], n_sus_per_file, duration_per_file); - argc--; - argv++; - break; +} - case 'v': *verbose = 1; break; - default: usage(); - } - argc--; - argv++; - } +void static +process_arguments(char **argv, +int argc, +int *monitoring, +int *verbose, +int *n_sus_per_file, +int *duration_per_file, +int *stop_after_interval, +int *drop_fisus, +int *esnf, +char **hostname, +Channel_t channels[], +int *n_channels, +char **base_filename, +enum PCap_format *format) +{ + int current_arg; + + while (argc > 1 && argv[1][0] == '-') { + switch (argv[1][1]) { + case 'c': *format = PCAP_CLASSIC; break; + + case 'f': + if (argc < 3) { + usage(); + } + if (!strcmp("fisu=no", argv[2])) { + *drop_fisus = 1; + } + else if (!strcmp("esnf=yes", argv[2])) { + *esnf = 1; + } + argc--; + argv++; + break; + + case 'm': *monitoring = 1; break; + + case 'n': + if (argc < 3) { + usage(); + } + parse_rotation(argv[2], n_sus_per_file, duration_per_file); + argc--; + argv++; + break; + + case 's': *stop_after_interval = 1; break; + + case 'v': *verbose = 1; break; + + default: usage(); + } + argc--; + argv++; + } - if (argc < 4) { - usage(); - } + if (argc < 4) { + usage(); + } - *hostname = argv[1]; + *hostname = argv[1]; - argv += 2; - argc -= 2; + argv += 2; + argc -= 2; - current_arg = arguments_to_channels(argc, argv, channels, n_channels); - if (!n_channels){ - die("No timeslots given (or, perhaps, no output filename given)."); - } + current_arg = arguments_to_channels(argc, argv, channels, n_channels); + if (!n_channels){ + die("No timeslots given (or, perhaps, no output filename given)."); + } - print_channels(channels, *n_channels); + print_channels(channels, *n_channels); - *base_filename = argv[current_arg]; + *base_filename = argv[current_arg]; } // Entry point int main(int argc, char **argv) { - GTH_api api; - int data_socket = -1; - int result; - int monitoring = 0; - int verbose = 0; - Channel_t channels[MAX_MTP2_CHANNELS]; - int i; - int n_channels = 0; - int n_sus_per_file = 0; - int duration_per_file = 0; - int drop_fisus = 0; - int esnf = 0; - int listen_port = 0; - int listen_socket = -1; - enum PCap_format format = PCAP_NG; - char *hostname; - char *base_filename; - - // Check a couple of assumptions about type size. - assert(sizeof(u32) == 4); - assert(sizeof(u16) == 2); - - win32_specific_startup(); - - process_arguments(argv, argc, - &monitoring, &verbose, &n_sus_per_file, &duration_per_file, - &drop_fisus, &esnf, &hostname, channels, &n_channels, - &base_filename, &format); - result = gth_connect(&api, hostname, verbose); - if (result != 0) { - die("Unable to connect to the GTH. Giving up."); - } - - read_hw_description(&api, hostname); - enable_l1(&api, channels, n_channels, monitoring); - - listen_socket = gth_make_listen_socket(&listen_port); - for (i = 0; i < n_channels; i++){ - monitor_mtp2(&api, channels + i, - i, drop_fisus, esnf, listen_port, listen_socket); - if (i == 0) { - data_socket = gth_wait_for_accept(listen_socket); - } - } - - fprintf(stderr, "capturing packets, press ^C to abort\n"); - convert_to_pcap(&api, data_socket, base_filename, - n_sus_per_file, duration_per_file, - channels, n_channels, format); - - return 0; // not reached + GTH_api api; + int data_socket = -1; + int result; + int monitoring = 0; + int verbose = 0; + Channel_t channels[MAX_MTP2_CHANNELS]; + int i; + int n_channels = 0; + int n_sus_per_file = 0; + int duration_per_file = 0; + int stop_after_interval = 0; + int drop_fisus = 0; + int esnf = 0; + int listen_port = 0; + int listen_socket = -1; + enum PCap_format format = PCAP_NG; + char *hostname; + char *base_filename; + + // Check a couple of assumptions about type size. + assert(sizeof(u32) == 4); + assert(sizeof(u16) == 2); + + win32_specific_startup(); + + process_arguments(argv, argc, + &monitoring, &verbose, &n_sus_per_file, &duration_per_file, &stop_after_interval, + &drop_fisus, &esnf, &hostname, channels, &n_channels, + &base_filename, &format); + result = gth_connect(&api, hostname, verbose); + if (result != 0) { + die("Unable to connect to the GTH. Giving up."); + } + + read_hw_description(&api, hostname); + enable_l1(&api, channels, n_channels, monitoring); + + listen_socket = gth_make_listen_socket(&listen_port); + for (i = 0; i < n_channels; i++){ + monitor_mtp2(&api, channels + i, + i, drop_fisus, esnf, listen_port, listen_socket); + if (i == 0) { + data_socket = gth_wait_for_accept(listen_socket); + } + } + + fprintf(stderr, "capturing packets, press ^C to abort\n"); + convert_to_pcap(&api, data_socket, base_filename, + n_sus_per_file, duration_per_file, stop_after_interval, + channels, n_channels, format); + + return 0; // not reached } // eof From c382a03699cf0cbe6a06d469518a3ff0308a81f7 Mon Sep 17 00:00:00 2001 From: r1pper Date: Sat, 25 Jul 2015 01:34:08 +0430 Subject: [PATCH 03/20] Date time added to filename date time added to filename (added by oka) --- c/save_to_pcap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index faf88a6..f7c32a4 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -888,16 +888,21 @@ const enum PCap_format format) init_timer(duration_per_file); int always_true = 1; + time_t rawtime; + struct tm * timeinfo; while (always_true) { char filename[MAX_FILENAME]; + time(&rawtime); + timeinfo = localtime(&rawtime); if (!write_to_stdout && !write_to_pipe) { if (!stop_after_interval) { - snprintf(filename, MAX_FILENAME, "%s.%d", - base_name, file_number); + snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", + base_name, file_number, timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else { From 56fd001b34c83e9f3dd7a13c447cfd3b6a8bb36f Mon Sep 17 00:00:00 2001 From: r1pper Date: Sat, 25 Jul 2015 01:58:02 +0430 Subject: [PATCH 04/20] fixed multi instance issue emoved timer name "file_rotation_timer" to support multiple instances --- c/save_to_pcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index f7c32a4..e8a688d 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -784,7 +784,7 @@ set_timer(int seconds) static void init_timer(int seconds) { - timer = CreateWaitableTimer(NULL, TRUE, "file_rotation_timer"); + timer = CreateWaitableTimer(NULL, TRUE, NULL); if (timer == NULL) die("CreateWaitableTimer failed"); set_timer(seconds); } From cbcd22dd26d197bff5191c220133c4f480948c94 Mon Sep 17 00:00:00 2001 From: gemik Date: Mon, 27 Jul 2015 17:02:19 +0200 Subject: [PATCH 05/20] add parameter for output file format parameter -o is added --- c/save_to_pcap.c | 75 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index e8a688d..0aa5723 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -181,6 +181,10 @@ usage() { "\n-n : rotate the output file after seconds" "\n-s Stop the process instead of rotating the files" "\n-v: print API commands and responses (verbose)" + "\n-o: Output format" + "\n\tdefault: it uses in output file name base_name with counter number (default option)" + "\n\tutc=no: add local time after counter number (standard output like tshark)" + "\n\tutc=yes: add utc time after counter number (standard output like tshark)" "\n" "\n is the GTH's IP address or hostname" "\n is a list of spans and timeslots:" @@ -207,7 +211,8 @@ usage() { "./save_to_pcap -m -n duration:60 172.16.1.10 1A 2A 16 isup_capture.pcapng\n" "./save_to_pcap -c 172.16.1.10 1A 2A 16 - | tshark -V -i - \n" "./save_to_pcap -c 172.16.1.10 1A 2A 16 - | wireshark -k -i - \n" - "./save_to_pcap -c 172.16.1.10 1A 2A 16 \\\\.\\pipe\\isup_capture.1\n"); + "./save_to_pcap -c 172.16.1.10 1A 2A 16 \\\\.\\pipe\\isup_capture.1\n" + "./save_to_pcap -o utc=yes 172.16.1.10 1A 2A 16 isup_capture.pcapng\n"); fprintf(stderr, "\nExamples (on SDH/SONET hardware, usually optical):\n" @@ -870,6 +875,7 @@ const char *base_name, const int n_sus_per_file, const int duration_per_file, const int stop_after_interval, +const int output_filename_format, Channel_t channels[], int n_channels, const enum PCap_format format) @@ -894,21 +900,49 @@ const enum PCap_format format) while (always_true) { char filename[MAX_FILENAME]; - time(&rawtime); - timeinfo = localtime(&rawtime); if (!write_to_stdout && !write_to_pipe) { + if (output_filename_format > 0) + { + time(&rawtime); + if (output_filename_format == 1) + timeinfo = localtime(&rawtime); // local time + else + timeinfo = gmtime(&rawtime); // utc time + } if (!stop_after_interval) { - snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", - base_name, file_number, timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); + if (output_filename_format > 0) + { + snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", + base_name, file_number, + timeinfo->tm_year + 1900, + timeinfo->tm_mon + 1, + timeinfo->tm_mday, + timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); + } + else + { + snprintf(filename, MAX_FILENAME, "%s_%05d", + base_name, file_number); + } } else { - snprintf(filename, MAX_FILENAME, "%s", - base_name); - + if (output_filename_format > 0) + { + snprintf(filename, MAX_FILENAME, "%s_%04d%02d%02d%02d%02d%02d", + base_name, + timeinfo->tm_year + 1900, + timeinfo->tm_mon + 1, + timeinfo->tm_mday, + timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); + } + else + { + snprintf(filename, MAX_FILENAME, "%s", + base_name); + } } open_file_for_writing(&file, filename); fprintf(stderr, "saving to file %s\n", filename); @@ -1174,6 +1208,7 @@ int *verbose, int *n_sus_per_file, int *duration_per_file, int *stop_after_interval, +int *output_filename_format, int *drop_fisus, int *esnf, char **hostname, @@ -1215,6 +1250,23 @@ enum PCap_format *format) case 's': *stop_after_interval = 1; break; + case 'o': + if (argc < 3) { + usage(); + } + if (!strcmp("utc=yes", argv[2])) { + *output_filename_format = 2; + } + else if (!strcmp("utc=no", argv[2])) { + *output_filename_format = 1; + } + else if (!strcmp("default", argv[2])) { + *output_filename_format = 0; + } + argc--; + argv++; + break; + case 'v': *verbose = 1; break; default: usage(); @@ -1257,6 +1309,7 @@ main(int argc, char **argv) int n_sus_per_file = 0; int duration_per_file = 0; int stop_after_interval = 0; + int output_filename_format = 0; int drop_fisus = 0; int esnf = 0; int listen_port = 0; @@ -1272,7 +1325,7 @@ main(int argc, char **argv) win32_specific_startup(); process_arguments(argv, argc, - &monitoring, &verbose, &n_sus_per_file, &duration_per_file, &stop_after_interval, + &monitoring, &verbose, &n_sus_per_file, &duration_per_file, &stop_after_interval, &output_filename_format, &drop_fisus, &esnf, &hostname, channels, &n_channels, &base_filename, &format); result = gth_connect(&api, hostname, verbose); @@ -1294,7 +1347,7 @@ main(int argc, char **argv) fprintf(stderr, "capturing packets, press ^C to abort\n"); convert_to_pcap(&api, data_socket, base_filename, - n_sus_per_file, duration_per_file, stop_after_interval, + n_sus_per_file, duration_per_file, stop_after_interval, output_filename_format, channels, n_channels, format); return 0; // not reached From 68301a376f10a42700201e02756e79e8ae01dc8f Mon Sep 17 00:00:00 2001 From: r1pper Date: Tue, 28 Jul 2015 21:10:44 +0430 Subject: [PATCH 06/20] time error --- c/save_to_pcap.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index 0aa5723..fbe348e 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -51,6 +51,7 @@ #include #include #include +#include #ifdef WIN32 #include @@ -786,6 +787,20 @@ set_timer(int seconds) if (!result) die("SetWaitableTimer failed"); } +static void +set_timer_milli(int milliSeconds) +{ + LARGE_INTEGER liDueTime; + int result; + + liDueTime.QuadPart = milliSeconds; + // Timer is in 100ns units. Negative means relative timeout. + liDueTime.QuadPart *= -10000LL; + + result = SetWaitableTimer(timer, &liDueTime, 0, NULL, NULL, 0); + if (!result) die("SetWaitableTimer failed"); +} + static void init_timer(int seconds) { @@ -895,7 +910,13 @@ const enum PCap_format format) int always_true = 1; time_t rawtime; - struct tm * timeinfo; + struct tm * timeinfo=NULL; + + struct timeb start,stop; + int diff=0; + int currentdiff=0; + int error=0; + int suggestion=duration_per_file; while (always_true) { char filename[MAX_FILENAME]; @@ -904,7 +925,10 @@ const enum PCap_format format) { if (output_filename_format > 0) { - time(&rawtime); + //if(timeinfo==NULL) + time(&rawtime); + ftime(&start); + if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else @@ -994,6 +1018,25 @@ const enum PCap_format format) always_true = 0; } fclose(file); + + if (output_filename_format > 0) + { + ftime(&stop); + + currentdiff = (int) (1000.0 * (stop.time - start.time)+ (stop.millitm - start.millitm)); + fprintf(stderr, "Time difference in interval %d ms\n", currentdiff); + + error = currentdiff - (duration_per_file * 1000); + fprintf(stderr, "Interval error %d ms\n", error); + + diff += error; + fprintf(stderr, "Total error %d ms\n", diff); + + suggestion=1000 * duration_per_file - diff; + //rawtime=flushtime; + fprintf(stderr, "Interval time set to %d ms\n", suggestion); + set_timer_milli(suggestion); + } } } From 620b17d6fd8db241ce8bd313f4d8cfade1adb939 Mon Sep 17 00:00:00 2001 From: arashdalir Date: Wed, 29 Jul 2015 19:58:51 +0200 Subject: [PATCH 07/20] Drifting Problem 90% resolved :D --- c/save_to_pcap.c | 185 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 146 insertions(+), 39 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index fbe348e..f9645d1 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -481,6 +481,12 @@ write_pcap_classic_header(HANDLE_OR_FILEPTR file) // The pcap file is native-endian, i.e. wireshark uses the magic value // to figure out if it was created on a little-endian or big-endian machine. + /* + TIMESTAMP PRECISION NOTICE: + using 0xa1b2c3d4, the application informs readers that the timestamp precision is set to MICROseconds. + using 0xa1b2c34d, the application informs readers that the timestamp precision is set to NANOseconds. + if the magic number is changed, the code should be checked for other "TIMESTAMP PRECISION NOTICE"s to ensure their sanity. + */ header.magic = 0xa1b2c3d4; header.major_version = 2; header.minor_version = 4; @@ -568,6 +574,10 @@ write_pcap_idbs(HANDLE_OR_FILEPTR file, Channel_t *c, int n) PCap_NG_option if_name; char idb_if_name[MAX_IF_NAME]; PCap_NG_option if_tsresol; + /* + TIMESTAMP PRECISION NOTICE: + Precision is set to MILLIseconds (10^-3 seconds) + */ char tsresol[4] = { 3, 0, 0, 0 }; // 10^-3 resolution, three padding bytes u32 block_total_length; @@ -882,6 +892,45 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) #define MAX_FILENAME 100 + +static unsigned long long convert_timestamp_ms( + u32 ts_hi, + u32 ts_lo, + const enum PCap_format format) +{ + unsigned long long ts_sec; + unsigned long long ts_us; + unsigned long long ts_ms; + + + assert(sizeof ts_sec == 8); + + ts_us = ts_hi; + ts_us <<= 32; + ts_us += ts_lo; + /* + if (format == PCAP_CLASSIC) + { + /* + TIMESTAMP PRECISION NOTICE: + convert microseconds into milliseconds + * / + //ts_ms = (ts_us / 1000); + } + else + { + + ts_ms = ts_us; + } + */ + + ts_ms = ts_us; + + return ts_ms; +} + +//3651096057 + // Loop forever, converting the incoming GTH data to libpcap format static void convert_to_pcap(GTH_api *api, @@ -910,15 +959,27 @@ const enum PCap_format format) int always_true = 1; time_t rawtime; - struct tm * timeinfo=NULL; - - struct timeb start,stop; - int diff=0; - int currentdiff=0; - int error=0; - int suggestion=duration_per_file; + struct tm * timeinfo = NULL; + + struct timeb start, stop; + int diff = 0; + u32 currentdiff; + int error = 0; + int suggestion = duration_per_file * 1000; + + u32 begin_sec; + u32 begin_usec; + unsigned long long begin_ts; + + u32 curr_sec = 0; + u32 curr_usec = 0; + unsigned long long curr_ts; while (always_true) { + begin_sec = 0; + begin_usec = 0; + currentdiff = 0; + char filename[MAX_FILENAME]; if (!write_to_stdout && !write_to_pipe) @@ -926,23 +987,23 @@ const enum PCap_format format) if (output_filename_format > 0) { //if(timeinfo==NULL) - time(&rawtime); - ftime(&start); - + time(&rawtime); + if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else timeinfo = gmtime(&rawtime); // utc time } + if (!stop_after_interval) { if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", - base_name, file_number, - timeinfo->tm_year + 1900, + base_name, file_number, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -956,10 +1017,10 @@ const enum PCap_format format) if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%04d%02d%02d%02d%02d%02d", - base_name, - timeinfo->tm_year + 1900, + base_name, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -987,6 +1048,8 @@ const enum PCap_format format) file_number++; su_count = 0; + ftime(&start); + int rotation_time_reached = 0; do { @@ -997,45 +1060,89 @@ const enum PCap_format format) assert(length <= sizeof signal_unit); read_exact(data_socket, (void*)&signal_unit, length); + curr_sec = ntohs(signal_unit.timestamp_hi); + curr_usec = ntohl(signal_unit.timestamp_lo); + length -= (signal_unit.payload - (char*)&(signal_unit.tag)); write_packet(file, - ntohs(signal_unit.timestamp_hi), - ntohl(signal_unit.timestamp_lo), + curr_sec, + curr_usec, ntohs(signal_unit.tag), signal_unit.payload, length, format); flush_file(file); su_count++; + + if (!write_to_pipe && !write_to_stdout) + { + if (!begin_sec && !begin_usec) + { + begin_sec = curr_sec; + begin_usec = curr_usec; + begin_ts = convert_timestamp_ms(begin_sec, begin_usec, format); + } + else if (duration_per_file) + { + curr_ts = convert_timestamp_ms(curr_sec, curr_usec, format); + + currentdiff = (u32)curr_ts - begin_ts; + + if (currentdiff >= (1000.0 * duration_per_file)) + { + fprintf(stderr, "Time difference detected based on file contents: %d ms\n", currentdiff); + set_timer(duration_per_file); + break; + + } + else + { + currentdiff = 0; + } + } + } } - } while (!(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) + } while ( + !(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) || write_to_pipe - || write_to_stdout); + || write_to_stdout + ); - if (rotation_time_reached && stop_after_interval) - { - fprintf(stderr, "Stopped capturing when rotation time reached\n"); - always_true = 0; - } + ftime(&stop); fclose(file); - - if (output_filename_format > 0) + + if (!write_to_pipe && !write_to_stdout) { - ftime(&stop); + if (rotation_time_reached && stop_after_interval) + { + fprintf(stderr, "Stopped capturing when rotation time reached\n"); + always_true = 0; + } + else if (duration_per_file) + { + if (!currentdiff) + { + currentdiff = (int)(1000.0 * (stop.time - start.time) + (stop.millitm - start.millitm)); + fprintf(stderr, "Time difference detected based on file writing process: %d ms\n", currentdiff); + + error = currentdiff - (duration_per_file * 1000); - currentdiff = (int) (1000.0 * (stop.time - start.time)+ (stop.millitm - start.millitm)); - fprintf(stderr, "Time difference in interval %d ms\n", currentdiff); + fprintf(stderr, "Interval error %d ms\n", error); - error = currentdiff - (duration_per_file * 1000); - fprintf(stderr, "Interval error %d ms\n", error); + if (error > 0) + { + error = (int)(1.2 * error); + } + diff += error; + fprintf(stderr, "Total error %d ms\n", diff); + suggestion = 1000 * duration_per_file - diff; + //rawtime=flushtime; + fprintf(stderr, "Interval time set to %d ms\n", suggestion); + set_timer_milli(suggestion); + } + } - diff += error; - fprintf(stderr, "Total error %d ms\n", diff); - suggestion=1000 * duration_per_file - diff; - //rawtime=flushtime; - fprintf(stderr, "Interval time set to %d ms\n", suggestion); - set_timer_milli(suggestion); } } } @@ -1293,7 +1400,7 @@ enum PCap_format *format) case 's': *stop_after_interval = 1; break; - case 'o': + case 'o': if (argc < 3) { usage(); } From 5ab6bdb9686ac646a5ba309e95a536b9794fe9a4 Mon Sep 17 00:00:00 2001 From: arashdalir Date: Wed, 29 Jul 2015 20:02:52 +0200 Subject: [PATCH 08/20] Revert "Drifting Problem 90% resolved :D" This reverts commit 620b17d6fd8db241ce8bd313f4d8cfade1adb939. --- c/save_to_pcap.c | 185 ++++++++++------------------------------------- 1 file changed, 39 insertions(+), 146 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index f9645d1..fbe348e 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -481,12 +481,6 @@ write_pcap_classic_header(HANDLE_OR_FILEPTR file) // The pcap file is native-endian, i.e. wireshark uses the magic value // to figure out if it was created on a little-endian or big-endian machine. - /* - TIMESTAMP PRECISION NOTICE: - using 0xa1b2c3d4, the application informs readers that the timestamp precision is set to MICROseconds. - using 0xa1b2c34d, the application informs readers that the timestamp precision is set to NANOseconds. - if the magic number is changed, the code should be checked for other "TIMESTAMP PRECISION NOTICE"s to ensure their sanity. - */ header.magic = 0xa1b2c3d4; header.major_version = 2; header.minor_version = 4; @@ -574,10 +568,6 @@ write_pcap_idbs(HANDLE_OR_FILEPTR file, Channel_t *c, int n) PCap_NG_option if_name; char idb_if_name[MAX_IF_NAME]; PCap_NG_option if_tsresol; - /* - TIMESTAMP PRECISION NOTICE: - Precision is set to MILLIseconds (10^-3 seconds) - */ char tsresol[4] = { 3, 0, 0, 0 }; // 10^-3 resolution, three padding bytes u32 block_total_length; @@ -892,45 +882,6 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) #define MAX_FILENAME 100 - -static unsigned long long convert_timestamp_ms( - u32 ts_hi, - u32 ts_lo, - const enum PCap_format format) -{ - unsigned long long ts_sec; - unsigned long long ts_us; - unsigned long long ts_ms; - - - assert(sizeof ts_sec == 8); - - ts_us = ts_hi; - ts_us <<= 32; - ts_us += ts_lo; - /* - if (format == PCAP_CLASSIC) - { - /* - TIMESTAMP PRECISION NOTICE: - convert microseconds into milliseconds - * / - //ts_ms = (ts_us / 1000); - } - else - { - - ts_ms = ts_us; - } - */ - - ts_ms = ts_us; - - return ts_ms; -} - -//3651096057 - // Loop forever, converting the incoming GTH data to libpcap format static void convert_to_pcap(GTH_api *api, @@ -959,27 +910,15 @@ const enum PCap_format format) int always_true = 1; time_t rawtime; - struct tm * timeinfo = NULL; - - struct timeb start, stop; - int diff = 0; - u32 currentdiff; - int error = 0; - int suggestion = duration_per_file * 1000; - - u32 begin_sec; - u32 begin_usec; - unsigned long long begin_ts; - - u32 curr_sec = 0; - u32 curr_usec = 0; - unsigned long long curr_ts; + struct tm * timeinfo=NULL; + + struct timeb start,stop; + int diff=0; + int currentdiff=0; + int error=0; + int suggestion=duration_per_file; while (always_true) { - begin_sec = 0; - begin_usec = 0; - currentdiff = 0; - char filename[MAX_FILENAME]; if (!write_to_stdout && !write_to_pipe) @@ -987,23 +926,23 @@ const enum PCap_format format) if (output_filename_format > 0) { //if(timeinfo==NULL) - time(&rawtime); - + time(&rawtime); + ftime(&start); + if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else timeinfo = gmtime(&rawtime); // utc time } - if (!stop_after_interval) { if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", - base_name, file_number, - timeinfo->tm_year + 1900, + base_name, file_number, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -1017,10 +956,10 @@ const enum PCap_format format) if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%04d%02d%02d%02d%02d%02d", - base_name, - timeinfo->tm_year + 1900, + base_name, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -1048,8 +987,6 @@ const enum PCap_format format) file_number++; su_count = 0; - ftime(&start); - int rotation_time_reached = 0; do { @@ -1060,89 +997,45 @@ const enum PCap_format format) assert(length <= sizeof signal_unit); read_exact(data_socket, (void*)&signal_unit, length); - curr_sec = ntohs(signal_unit.timestamp_hi); - curr_usec = ntohl(signal_unit.timestamp_lo); - length -= (signal_unit.payload - (char*)&(signal_unit.tag)); write_packet(file, - curr_sec, - curr_usec, + ntohs(signal_unit.timestamp_hi), + ntohl(signal_unit.timestamp_lo), ntohs(signal_unit.tag), signal_unit.payload, length, format); flush_file(file); su_count++; - - if (!write_to_pipe && !write_to_stdout) - { - if (!begin_sec && !begin_usec) - { - begin_sec = curr_sec; - begin_usec = curr_usec; - begin_ts = convert_timestamp_ms(begin_sec, begin_usec, format); - } - else if (duration_per_file) - { - curr_ts = convert_timestamp_ms(curr_sec, curr_usec, format); - - currentdiff = (u32)curr_ts - begin_ts; - - if (currentdiff >= (1000.0 * duration_per_file)) - { - fprintf(stderr, "Time difference detected based on file contents: %d ms\n", currentdiff); - set_timer(duration_per_file); - break; - - } - else - { - currentdiff = 0; - } - } - } } - } while ( - !(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) + } while (!(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) || write_to_pipe - || write_to_stdout - ); + || write_to_stdout); - ftime(&stop); + if (rotation_time_reached && stop_after_interval) + { + fprintf(stderr, "Stopped capturing when rotation time reached\n"); + always_true = 0; + } fclose(file); - - if (!write_to_pipe && !write_to_stdout) + + if (output_filename_format > 0) { - if (rotation_time_reached && stop_after_interval) - { - fprintf(stderr, "Stopped capturing when rotation time reached\n"); - always_true = 0; - } - else if (duration_per_file) - { - if (!currentdiff) - { - currentdiff = (int)(1000.0 * (stop.time - start.time) + (stop.millitm - start.millitm)); - fprintf(stderr, "Time difference detected based on file writing process: %d ms\n", currentdiff); - - error = currentdiff - (duration_per_file * 1000); + ftime(&stop); - fprintf(stderr, "Interval error %d ms\n", error); + currentdiff = (int) (1000.0 * (stop.time - start.time)+ (stop.millitm - start.millitm)); + fprintf(stderr, "Time difference in interval %d ms\n", currentdiff); - if (error > 0) - { - error = (int)(1.2 * error); - } - diff += error; - fprintf(stderr, "Total error %d ms\n", diff); - suggestion = 1000 * duration_per_file - diff; - //rawtime=flushtime; - fprintf(stderr, "Interval time set to %d ms\n", suggestion); - set_timer_milli(suggestion); - } - } + error = currentdiff - (duration_per_file * 1000); + fprintf(stderr, "Interval error %d ms\n", error); + diff += error; + fprintf(stderr, "Total error %d ms\n", diff); + suggestion=1000 * duration_per_file - diff; + //rawtime=flushtime; + fprintf(stderr, "Interval time set to %d ms\n", suggestion); + set_timer_milli(suggestion); } } } @@ -1400,7 +1293,7 @@ enum PCap_format *format) case 's': *stop_after_interval = 1; break; - case 'o': + case 'o': if (argc < 3) { usage(); } From cb885a3443f9bf8cc9662eebf8aed0d13b14d14b Mon Sep 17 00:00:00 2001 From: arashdalir Date: Wed, 29 Jul 2015 20:07:41 +0200 Subject: [PATCH 09/20] Revert "Revert "Drifting Problem 90% resolved :D"" This reverts commit 5ab6bdb9686ac646a5ba309e95a536b9794fe9a4. --- c/save_to_pcap.c | 185 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 146 insertions(+), 39 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index fbe348e..f9645d1 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -481,6 +481,12 @@ write_pcap_classic_header(HANDLE_OR_FILEPTR file) // The pcap file is native-endian, i.e. wireshark uses the magic value // to figure out if it was created on a little-endian or big-endian machine. + /* + TIMESTAMP PRECISION NOTICE: + using 0xa1b2c3d4, the application informs readers that the timestamp precision is set to MICROseconds. + using 0xa1b2c34d, the application informs readers that the timestamp precision is set to NANOseconds. + if the magic number is changed, the code should be checked for other "TIMESTAMP PRECISION NOTICE"s to ensure their sanity. + */ header.magic = 0xa1b2c3d4; header.major_version = 2; header.minor_version = 4; @@ -568,6 +574,10 @@ write_pcap_idbs(HANDLE_OR_FILEPTR file, Channel_t *c, int n) PCap_NG_option if_name; char idb_if_name[MAX_IF_NAME]; PCap_NG_option if_tsresol; + /* + TIMESTAMP PRECISION NOTICE: + Precision is set to MILLIseconds (10^-3 seconds) + */ char tsresol[4] = { 3, 0, 0, 0 }; // 10^-3 resolution, three padding bytes u32 block_total_length; @@ -882,6 +892,45 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) #define MAX_FILENAME 100 + +static unsigned long long convert_timestamp_ms( + u32 ts_hi, + u32 ts_lo, + const enum PCap_format format) +{ + unsigned long long ts_sec; + unsigned long long ts_us; + unsigned long long ts_ms; + + + assert(sizeof ts_sec == 8); + + ts_us = ts_hi; + ts_us <<= 32; + ts_us += ts_lo; + /* + if (format == PCAP_CLASSIC) + { + /* + TIMESTAMP PRECISION NOTICE: + convert microseconds into milliseconds + * / + //ts_ms = (ts_us / 1000); + } + else + { + + ts_ms = ts_us; + } + */ + + ts_ms = ts_us; + + return ts_ms; +} + +//3651096057 + // Loop forever, converting the incoming GTH data to libpcap format static void convert_to_pcap(GTH_api *api, @@ -910,15 +959,27 @@ const enum PCap_format format) int always_true = 1; time_t rawtime; - struct tm * timeinfo=NULL; - - struct timeb start,stop; - int diff=0; - int currentdiff=0; - int error=0; - int suggestion=duration_per_file; + struct tm * timeinfo = NULL; + + struct timeb start, stop; + int diff = 0; + u32 currentdiff; + int error = 0; + int suggestion = duration_per_file * 1000; + + u32 begin_sec; + u32 begin_usec; + unsigned long long begin_ts; + + u32 curr_sec = 0; + u32 curr_usec = 0; + unsigned long long curr_ts; while (always_true) { + begin_sec = 0; + begin_usec = 0; + currentdiff = 0; + char filename[MAX_FILENAME]; if (!write_to_stdout && !write_to_pipe) @@ -926,23 +987,23 @@ const enum PCap_format format) if (output_filename_format > 0) { //if(timeinfo==NULL) - time(&rawtime); - ftime(&start); - + time(&rawtime); + if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else timeinfo = gmtime(&rawtime); // utc time } + if (!stop_after_interval) { if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", - base_name, file_number, - timeinfo->tm_year + 1900, + base_name, file_number, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -956,10 +1017,10 @@ const enum PCap_format format) if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%04d%02d%02d%02d%02d%02d", - base_name, - timeinfo->tm_year + 1900, + base_name, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -987,6 +1048,8 @@ const enum PCap_format format) file_number++; su_count = 0; + ftime(&start); + int rotation_time_reached = 0; do { @@ -997,45 +1060,89 @@ const enum PCap_format format) assert(length <= sizeof signal_unit); read_exact(data_socket, (void*)&signal_unit, length); + curr_sec = ntohs(signal_unit.timestamp_hi); + curr_usec = ntohl(signal_unit.timestamp_lo); + length -= (signal_unit.payload - (char*)&(signal_unit.tag)); write_packet(file, - ntohs(signal_unit.timestamp_hi), - ntohl(signal_unit.timestamp_lo), + curr_sec, + curr_usec, ntohs(signal_unit.tag), signal_unit.payload, length, format); flush_file(file); su_count++; + + if (!write_to_pipe && !write_to_stdout) + { + if (!begin_sec && !begin_usec) + { + begin_sec = curr_sec; + begin_usec = curr_usec; + begin_ts = convert_timestamp_ms(begin_sec, begin_usec, format); + } + else if (duration_per_file) + { + curr_ts = convert_timestamp_ms(curr_sec, curr_usec, format); + + currentdiff = (u32)curr_ts - begin_ts; + + if (currentdiff >= (1000.0 * duration_per_file)) + { + fprintf(stderr, "Time difference detected based on file contents: %d ms\n", currentdiff); + set_timer(duration_per_file); + break; + + } + else + { + currentdiff = 0; + } + } + } } - } while (!(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) + } while ( + !(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) || write_to_pipe - || write_to_stdout); + || write_to_stdout + ); - if (rotation_time_reached && stop_after_interval) - { - fprintf(stderr, "Stopped capturing when rotation time reached\n"); - always_true = 0; - } + ftime(&stop); fclose(file); - - if (output_filename_format > 0) + + if (!write_to_pipe && !write_to_stdout) { - ftime(&stop); + if (rotation_time_reached && stop_after_interval) + { + fprintf(stderr, "Stopped capturing when rotation time reached\n"); + always_true = 0; + } + else if (duration_per_file) + { + if (!currentdiff) + { + currentdiff = (int)(1000.0 * (stop.time - start.time) + (stop.millitm - start.millitm)); + fprintf(stderr, "Time difference detected based on file writing process: %d ms\n", currentdiff); + + error = currentdiff - (duration_per_file * 1000); - currentdiff = (int) (1000.0 * (stop.time - start.time)+ (stop.millitm - start.millitm)); - fprintf(stderr, "Time difference in interval %d ms\n", currentdiff); + fprintf(stderr, "Interval error %d ms\n", error); - error = currentdiff - (duration_per_file * 1000); - fprintf(stderr, "Interval error %d ms\n", error); + if (error > 0) + { + error = (int)(1.2 * error); + } + diff += error; + fprintf(stderr, "Total error %d ms\n", diff); + suggestion = 1000 * duration_per_file - diff; + //rawtime=flushtime; + fprintf(stderr, "Interval time set to %d ms\n", suggestion); + set_timer_milli(suggestion); + } + } - diff += error; - fprintf(stderr, "Total error %d ms\n", diff); - suggestion=1000 * duration_per_file - diff; - //rawtime=flushtime; - fprintf(stderr, "Interval time set to %d ms\n", suggestion); - set_timer_milli(suggestion); } } } @@ -1293,7 +1400,7 @@ enum PCap_format *format) case 's': *stop_after_interval = 1; break; - case 'o': + case 'o': if (argc < 3) { usage(); } From 6d9a83c7ea6b87d42c9727bc44441acc3756cc6e Mon Sep 17 00:00:00 2001 From: arashdalir Date: Wed, 29 Jul 2015 20:08:46 +0200 Subject: [PATCH 10/20] Revert "Drifting Problem 90% resolved :D" This reverts commit 620b17d6fd8db241ce8bd313f4d8cfade1adb939. --- c/save_to_pcap.c | 185 ++++++++++------------------------------------- 1 file changed, 39 insertions(+), 146 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index f9645d1..fbe348e 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -481,12 +481,6 @@ write_pcap_classic_header(HANDLE_OR_FILEPTR file) // The pcap file is native-endian, i.e. wireshark uses the magic value // to figure out if it was created on a little-endian or big-endian machine. - /* - TIMESTAMP PRECISION NOTICE: - using 0xa1b2c3d4, the application informs readers that the timestamp precision is set to MICROseconds. - using 0xa1b2c34d, the application informs readers that the timestamp precision is set to NANOseconds. - if the magic number is changed, the code should be checked for other "TIMESTAMP PRECISION NOTICE"s to ensure their sanity. - */ header.magic = 0xa1b2c3d4; header.major_version = 2; header.minor_version = 4; @@ -574,10 +568,6 @@ write_pcap_idbs(HANDLE_OR_FILEPTR file, Channel_t *c, int n) PCap_NG_option if_name; char idb_if_name[MAX_IF_NAME]; PCap_NG_option if_tsresol; - /* - TIMESTAMP PRECISION NOTICE: - Precision is set to MILLIseconds (10^-3 seconds) - */ char tsresol[4] = { 3, 0, 0, 0 }; // 10^-3 resolution, three padding bytes u32 block_total_length; @@ -892,45 +882,6 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) #define MAX_FILENAME 100 - -static unsigned long long convert_timestamp_ms( - u32 ts_hi, - u32 ts_lo, - const enum PCap_format format) -{ - unsigned long long ts_sec; - unsigned long long ts_us; - unsigned long long ts_ms; - - - assert(sizeof ts_sec == 8); - - ts_us = ts_hi; - ts_us <<= 32; - ts_us += ts_lo; - /* - if (format == PCAP_CLASSIC) - { - /* - TIMESTAMP PRECISION NOTICE: - convert microseconds into milliseconds - * / - //ts_ms = (ts_us / 1000); - } - else - { - - ts_ms = ts_us; - } - */ - - ts_ms = ts_us; - - return ts_ms; -} - -//3651096057 - // Loop forever, converting the incoming GTH data to libpcap format static void convert_to_pcap(GTH_api *api, @@ -959,27 +910,15 @@ const enum PCap_format format) int always_true = 1; time_t rawtime; - struct tm * timeinfo = NULL; - - struct timeb start, stop; - int diff = 0; - u32 currentdiff; - int error = 0; - int suggestion = duration_per_file * 1000; - - u32 begin_sec; - u32 begin_usec; - unsigned long long begin_ts; - - u32 curr_sec = 0; - u32 curr_usec = 0; - unsigned long long curr_ts; + struct tm * timeinfo=NULL; + + struct timeb start,stop; + int diff=0; + int currentdiff=0; + int error=0; + int suggestion=duration_per_file; while (always_true) { - begin_sec = 0; - begin_usec = 0; - currentdiff = 0; - char filename[MAX_FILENAME]; if (!write_to_stdout && !write_to_pipe) @@ -987,23 +926,23 @@ const enum PCap_format format) if (output_filename_format > 0) { //if(timeinfo==NULL) - time(&rawtime); - + time(&rawtime); + ftime(&start); + if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else timeinfo = gmtime(&rawtime); // utc time } - if (!stop_after_interval) { if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", - base_name, file_number, - timeinfo->tm_year + 1900, + base_name, file_number, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -1017,10 +956,10 @@ const enum PCap_format format) if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%04d%02d%02d%02d%02d%02d", - base_name, - timeinfo->tm_year + 1900, + base_name, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -1048,8 +987,6 @@ const enum PCap_format format) file_number++; su_count = 0; - ftime(&start); - int rotation_time_reached = 0; do { @@ -1060,89 +997,45 @@ const enum PCap_format format) assert(length <= sizeof signal_unit); read_exact(data_socket, (void*)&signal_unit, length); - curr_sec = ntohs(signal_unit.timestamp_hi); - curr_usec = ntohl(signal_unit.timestamp_lo); - length -= (signal_unit.payload - (char*)&(signal_unit.tag)); write_packet(file, - curr_sec, - curr_usec, + ntohs(signal_unit.timestamp_hi), + ntohl(signal_unit.timestamp_lo), ntohs(signal_unit.tag), signal_unit.payload, length, format); flush_file(file); su_count++; - - if (!write_to_pipe && !write_to_stdout) - { - if (!begin_sec && !begin_usec) - { - begin_sec = curr_sec; - begin_usec = curr_usec; - begin_ts = convert_timestamp_ms(begin_sec, begin_usec, format); - } - else if (duration_per_file) - { - curr_ts = convert_timestamp_ms(curr_sec, curr_usec, format); - - currentdiff = (u32)curr_ts - begin_ts; - - if (currentdiff >= (1000.0 * duration_per_file)) - { - fprintf(stderr, "Time difference detected based on file contents: %d ms\n", currentdiff); - set_timer(duration_per_file); - break; - - } - else - { - currentdiff = 0; - } - } - } } - } while ( - !(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) + } while (!(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) || write_to_pipe - || write_to_stdout - ); + || write_to_stdout); - ftime(&stop); + if (rotation_time_reached && stop_after_interval) + { + fprintf(stderr, "Stopped capturing when rotation time reached\n"); + always_true = 0; + } fclose(file); - - if (!write_to_pipe && !write_to_stdout) + + if (output_filename_format > 0) { - if (rotation_time_reached && stop_after_interval) - { - fprintf(stderr, "Stopped capturing when rotation time reached\n"); - always_true = 0; - } - else if (duration_per_file) - { - if (!currentdiff) - { - currentdiff = (int)(1000.0 * (stop.time - start.time) + (stop.millitm - start.millitm)); - fprintf(stderr, "Time difference detected based on file writing process: %d ms\n", currentdiff); - - error = currentdiff - (duration_per_file * 1000); + ftime(&stop); - fprintf(stderr, "Interval error %d ms\n", error); + currentdiff = (int) (1000.0 * (stop.time - start.time)+ (stop.millitm - start.millitm)); + fprintf(stderr, "Time difference in interval %d ms\n", currentdiff); - if (error > 0) - { - error = (int)(1.2 * error); - } - diff += error; - fprintf(stderr, "Total error %d ms\n", diff); - suggestion = 1000 * duration_per_file - diff; - //rawtime=flushtime; - fprintf(stderr, "Interval time set to %d ms\n", suggestion); - set_timer_milli(suggestion); - } - } + error = currentdiff - (duration_per_file * 1000); + fprintf(stderr, "Interval error %d ms\n", error); + diff += error; + fprintf(stderr, "Total error %d ms\n", diff); + suggestion=1000 * duration_per_file - diff; + //rawtime=flushtime; + fprintf(stderr, "Interval time set to %d ms\n", suggestion); + set_timer_milli(suggestion); } } } @@ -1400,7 +1293,7 @@ enum PCap_format *format) case 's': *stop_after_interval = 1; break; - case 'o': + case 'o': if (argc < 3) { usage(); } From 10a616b7526a2626fd5500b1b556c2cd7a06c643 Mon Sep 17 00:00:00 2001 From: arashdalir Date: Wed, 29 Jul 2015 20:13:58 +0200 Subject: [PATCH 11/20] Going Back to Drifting Problem 90% resolved :D accidentally reverted the code - recommitting --- c/save_to_pcap.c | 186 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 146 insertions(+), 40 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index fbe348e..7023918 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -481,6 +481,12 @@ write_pcap_classic_header(HANDLE_OR_FILEPTR file) // The pcap file is native-endian, i.e. wireshark uses the magic value // to figure out if it was created on a little-endian or big-endian machine. + /* + TIMESTAMP PRECISION NOTICE: + using 0xa1b2c3d4, the application informs readers that the timestamp precision is set to MICROseconds. + using 0xa1b2c34d, the application informs readers that the timestamp precision is set to NANOseconds. + if the magic number is changed, the code should be checked for other "TIMESTAMP PRECISION NOTICE"s to ensure their sanity. + */ header.magic = 0xa1b2c3d4; header.major_version = 2; header.minor_version = 4; @@ -568,6 +574,10 @@ write_pcap_idbs(HANDLE_OR_FILEPTR file, Channel_t *c, int n) PCap_NG_option if_name; char idb_if_name[MAX_IF_NAME]; PCap_NG_option if_tsresol; + /* + TIMESTAMP PRECISION NOTICE: + Precision is set to MILLIseconds (10^-3 seconds) + */ char tsresol[4] = { 3, 0, 0, 0 }; // 10^-3 resolution, three padding bytes u32 block_total_length; @@ -882,6 +892,44 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) #define MAX_FILENAME 100 + +static unsigned long long convert_timestamp_ms( + u32 ts_hi, + u32 ts_lo, + const enum PCap_format format) +{ + unsigned long long ts_sec; + unsigned long long ts_us; + unsigned long long ts_ms; + + + assert(sizeof ts_sec == 8); + + ts_us = ts_hi; + ts_us <<= 32; + ts_us += ts_lo; + /* + if (format == PCAP_CLASSIC) + { + /* + TIMESTAMP PRECISION NOTICE: + convert microseconds into milliseconds + * / + //ts_ms = (ts_us / 1000); + } + else + { + ts_ms = ts_us; + } + */ + + ts_ms = ts_us; + + return ts_ms; +} + +//3651096057 + // Loop forever, converting the incoming GTH data to libpcap format static void convert_to_pcap(GTH_api *api, @@ -910,15 +958,27 @@ const enum PCap_format format) int always_true = 1; time_t rawtime; - struct tm * timeinfo=NULL; - - struct timeb start,stop; - int diff=0; - int currentdiff=0; - int error=0; - int suggestion=duration_per_file; + struct tm * timeinfo = NULL; + + struct timeb start, stop; + int diff = 0; + u32 currentdiff; + int error = 0; + int suggestion = duration_per_file * 1000; + + u32 begin_sec; + u32 begin_usec; + unsigned long long begin_ts; + + u32 curr_sec = 0; + u32 curr_usec = 0; + unsigned long long curr_ts; while (always_true) { + begin_sec = 0; + begin_usec = 0; + currentdiff = 0; + char filename[MAX_FILENAME]; if (!write_to_stdout && !write_to_pipe) @@ -926,23 +986,23 @@ const enum PCap_format format) if (output_filename_format > 0) { //if(timeinfo==NULL) - time(&rawtime); - ftime(&start); - + time(&rawtime); + if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else timeinfo = gmtime(&rawtime); // utc time } + if (!stop_after_interval) { if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%05d_%04d%02d%02d%02d%02d%02d", - base_name, file_number, - timeinfo->tm_year + 1900, + base_name, file_number, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -956,10 +1016,10 @@ const enum PCap_format format) if (output_filename_format > 0) { snprintf(filename, MAX_FILENAME, "%s_%04d%02d%02d%02d%02d%02d", - base_name, - timeinfo->tm_year + 1900, + base_name, + timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, - timeinfo->tm_mday, + timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); } else @@ -987,6 +1047,8 @@ const enum PCap_format format) file_number++; su_count = 0; + ftime(&start); + int rotation_time_reached = 0; do { @@ -997,45 +1059,89 @@ const enum PCap_format format) assert(length <= sizeof signal_unit); read_exact(data_socket, (void*)&signal_unit, length); + curr_sec = ntohs(signal_unit.timestamp_hi); + curr_usec = ntohl(signal_unit.timestamp_lo); + length -= (signal_unit.payload - (char*)&(signal_unit.tag)); write_packet(file, - ntohs(signal_unit.timestamp_hi), - ntohl(signal_unit.timestamp_lo), + curr_sec, + curr_usec, ntohs(signal_unit.tag), signal_unit.payload, length, format); flush_file(file); su_count++; + + if (!write_to_pipe && !write_to_stdout) + { + if (!begin_sec && !begin_usec) + { + begin_sec = curr_sec; + begin_usec = curr_usec; + begin_ts = convert_timestamp_ms(begin_sec, begin_usec, format); + } + else if (duration_per_file) + { + curr_ts = convert_timestamp_ms(curr_sec, curr_usec, format); + + currentdiff = (u32)curr_ts - begin_ts; + + if (currentdiff >= (1000.0 * duration_per_file)) + { + fprintf(stderr, "Time difference detected based on file contents: %d ms\n", currentdiff); + set_timer(duration_per_file); + break; + + } + else + { + currentdiff = 0; + } + } + } } - } while (!(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) + } while ( + !(rotation_time_reached = is_time_to_rotate(su_count, n_sus_per_file, duration_per_file)) || write_to_pipe - || write_to_stdout); + || write_to_stdout + ); - if (rotation_time_reached && stop_after_interval) - { - fprintf(stderr, "Stopped capturing when rotation time reached\n"); - always_true = 0; - } + ftime(&stop); fclose(file); - - if (output_filename_format > 0) + + if (!write_to_pipe && !write_to_stdout) { - ftime(&stop); + if (rotation_time_reached && stop_after_interval) + { + fprintf(stderr, "Stopped capturing when rotation time reached\n"); + always_true = 0; + } + else if (duration_per_file) + { + if (!currentdiff) + { + currentdiff = (int)(1000.0 * (stop.time - start.time) + (stop.millitm - start.millitm)); + fprintf(stderr, "Time difference detected based on file writing process: %d ms\n", currentdiff); + + error = currentdiff - (duration_per_file * 1000); - currentdiff = (int) (1000.0 * (stop.time - start.time)+ (stop.millitm - start.millitm)); - fprintf(stderr, "Time difference in interval %d ms\n", currentdiff); + fprintf(stderr, "Interval error %d ms\n", error); - error = currentdiff - (duration_per_file * 1000); - fprintf(stderr, "Interval error %d ms\n", error); + if (error > 0) + { + error = (int)(1.2 * error); + } + diff += error; + fprintf(stderr, "Total error %d ms\n", diff); + suggestion = 1000 * duration_per_file - diff; + //rawtime=flushtime; + fprintf(stderr, "Interval time set to %d ms\n", suggestion); + set_timer_milli(suggestion); + } + } - diff += error; - fprintf(stderr, "Total error %d ms\n", diff); - suggestion=1000 * duration_per_file - diff; - //rawtime=flushtime; - fprintf(stderr, "Interval time set to %d ms\n", suggestion); - set_timer_milli(suggestion); } } } @@ -1293,7 +1399,7 @@ enum PCap_format *format) case 's': *stop_after_interval = 1; break; - case 'o': + case 'o': if (argc < 3) { usage(); } @@ -1396,4 +1502,4 @@ main(int argc, char **argv) return 0; // not reached } -// eof +// eof \ No newline at end of file From a187f42c472ea340816917db990df879ef062065 Mon Sep 17 00:00:00 2001 From: arashdalir Date: Wed, 29 Jul 2015 20:18:08 +0200 Subject: [PATCH 12/20] ignoring .obj files --- .gitignore | 2 ++ c/Corelatus-GTH-example-code.v12.suo | Bin 10240 -> 18944 bytes 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0fde286..ebc5637 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ CVS *~ .cvsignore *.zip +*.suo +*.obj diff --git a/c/Corelatus-GTH-example-code.v12.suo b/c/Corelatus-GTH-example-code.v12.suo index 7d2ce174576d52c5638b64108f6c09a19f2c1ec1..93f06e8bf5e321dc5d4daf54d53f3be5f3561464 100644 GIT binary patch literal 18944 zcmeHOYm8e*6&|-uN%}~dM?(oEaW|W`G_~=1ABod#h@WvD+YQYVWU+F*cQ>1Q*Ou)~ zHe?qeezYY8RMARMsg>F)AW=b3Bm@HG2c!bg@*@#~AHbgm3H3)oz%M{bW4>?ho!#rZ z*Y@?byAR~C&b>2pXXeb~%sFSy8DGD)_PsYQZ@M8YVYj$l+$ygUcbf7&h~K8t_X%+a z;>^2ME|-~oI{?vkSVlAOw8-IC5?&D(6L=TIIWDE+uu-g-UGrJms8ajIWBac>_U?7h zC;5H7Ug!`o=EP~S57AI_Sg@*GS<9aWUMqYj{s{?JR=SQTM@X9;;CUyRDLbo zY@!qRR~YR%#lPPu&-(WRJ~U5Y6LIo^kE6YffCm6fe**7KfDM2L0iObF25bR%0S^H> z09yf_0M==Tg`0te-2dWBzna_sBnX7X*#CpT+ur|j`e%73Wz_le%hEbnmoV1|w)%tU7?g88jSPfVMV41ae zuQTG@(v&Bp9m)a90LA|)^SS=y{j5j+&$pHTZ$tjWfJXq20zM6R46q%*@;nflx)WeiMS`g!M7IeK(uVa1&T;L}ysWy&@sPI~P zp}skJL;v-7P>^~R3DHR%^5TL~@Hq5Nu6a(J#hRoMPlFbyf%?%aew#pQSR{~>#$0Ha z9dqade&QuRaEgB)%958b97B6YfSs#-63;161hJn1?hIn}LI>u5JqnSxIK>}CS@JrD z7;v1#nvWWzK8{hAfcezCk?Q5GPcOz#-bQ}s6n_F`4fSUp{s_jdp%2f1@^fz+R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wLRy}b1v|#hjlhg5={m)kX15$URPIs=t7hlZ} z3IDV7|E+5Pe>ch=0Wj3^|2g#k%DW70|F5nQ=(Ae?spx;P{l8ZFYy1Cb-fqnQ$CY2M z{y*!P((LJN-~U+__kZMnwA|kRi9){77R}p6W1#%Autd<;PMJ|$7YU51*NF3PCy~^m+ywIHgx>-*(yW_PK&_|9akrYA|CV{ojVkqoRkrhfg24M_l&Ab_MV|9}Xts zJ9^?>zQ~TAZeLedEZ_^ryTZOeARLH>0*OQ-+C4MfKQLCzB*wB@arbm=S1Mn~oz^m? zVro2{AIjtk1udH{ zz5Epfio^rL11cSub+vZ>;&X`eA1CzwDXMP#_5gj)OF^HY*ZE#pP?thqYTab*$H^ow z&xN~Xf4NT7bQU`(3NZJhnLKkl3l(qQpHX*I+V^Md?>gDv=xN`d5#m{F(xt#V-SCQL N`6ufWVlIX7{{T<$G?oAW delta 700 zcmYjO!A=@c6rDTH;DB!iw4!2+LgE4wgrc=cj`)VMCbI^ z2WcB#=|D-_sThr+)3QFq2&%$MH*H#AZYIW?Wxo7Cu-Pz{IKoA)M4Rx+oGRnW2=7l7 zFe*2(Z||X3X`5>-wGd<*N@kTmz9+82TX^$mxYaY|tAx|VGxnG?1nGv#F|{14NQjRa z4c$!B60f69vXy_CbH8AqGwZ5Fma;L~6gTb=>^#d Date: Wed, 29 Jul 2015 20:20:22 +0200 Subject: [PATCH 13/20] ignored .sdf files --- .gitignore | 1 + c/Corelatus-GTH-example-code.sdf | Bin 393216 -> 65536 bytes 2 files changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ebc5637..5e024fc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ CVS *.zip *.suo *.obj +*.sdf diff --git a/c/Corelatus-GTH-example-code.sdf b/c/Corelatus-GTH-example-code.sdf index 4d8cd8f597cf1c198f6f5a505893d3605420bce9..f5c92ffab699abe2596877bbb6bfbe098231baef 100644 GIT binary patch delta 196 zcmZo@kZ5RN(JgsdUBG}0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!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p z2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!H?xfB*=900@8p2!Ozu HC-DCPR8z%o From e4467c4ed4adee14bd6ee4df68b07735a030cbf9 Mon Sep 17 00:00:00 2001 From: r1pper Date: Thu, 30 Jul 2015 15:19:17 +0430 Subject: [PATCH 14/20] time drifting fix with absolute interval --- c/save_to_pcap.c | 134 +++++++++++++++-------------------------------- 1 file changed, 43 insertions(+), 91 deletions(-) diff --git a/c/save_to_pcap.c b/c/save_to_pcap.c index 7023918..a051950 100644 --- a/c/save_to_pcap.c +++ b/c/save_to_pcap.c @@ -893,39 +893,30 @@ is_time_to_rotate(int su_count, int n_sus_per_file, int duration) #define MAX_FILENAME 100 -static unsigned long long convert_timestamp_ms( +static unsigned long long convert_timestamp_micro( u32 ts_hi, u32 ts_lo, const enum PCap_format format) { - unsigned long long ts_sec; - unsigned long long ts_us; - unsigned long long ts_ms; - - - assert(sizeof ts_sec == 8); - - ts_us = ts_hi; - ts_us <<= 32; - ts_us += ts_lo; - /* - if (format == PCAP_CLASSIC) - { - /* - TIMESTAMP PRECISION NOTICE: - convert microseconds into milliseconds - * / - //ts_ms = (ts_us / 1000); - } - else - { - ts_ms = ts_us; - } - */ - - ts_ms = ts_us; + unsigned long long ts; + + assert(sizeof ts == 8); + + ts = ts_hi; + ts <<= 32; + ts += ts_lo; + + //if (format != PCAP_CLASSIC) + //TIMESTAMP PRECISION NOTICE: + //convert milliseconds into microseconds + ts *=1000; + + return ts; +} - return ts_ms; +static unsigned long long convert_epoch_micro(time_t time) +{ + return time*1000000;//microseconds precision } //3651096057 @@ -960,38 +951,40 @@ const enum PCap_format format) time_t rawtime; struct tm * timeinfo = NULL; - struct timeb start, stop; - int diff = 0; - u32 currentdiff; - int error = 0; - int suggestion = duration_per_file * 1000; - - u32 begin_sec; - u32 begin_usec; - unsigned long long begin_ts; - + unsigned long long interval_threshold=0; + u32 curr_sec = 0; u32 curr_usec = 0; unsigned long long curr_ts; while (always_true) { - begin_sec = 0; - begin_usec = 0; - currentdiff = 0; - char filename[MAX_FILENAME]; if (!write_to_stdout && !write_to_pipe) { if (output_filename_format > 0) { - //if(timeinfo==NULL) - time(&rawtime); + if(timeinfo==NULL) //setting interval time + time(&rawtime); + else + rawtime+=duration_per_file; //hard setting next interval (duration_per_file is in seconds) if (output_filename_format == 1) timeinfo = localtime(&rawtime); // local time else - timeinfo = gmtime(&rawtime); // utc time + timeinfo = gmtime(&rawtime); // utc time + + interval_threshold=convert_epoch_micro(rawtime+duration_per_file); + + fprintf(stderr, "interval started at %04d/%02d/%02d %02d:%02d:%02d\n", + timeinfo->tm_year + 1900, + timeinfo->tm_mon + 1, + timeinfo->tm_mday, + timeinfo->tm_hour, + timeinfo->tm_min, + timeinfo->tm_sec); + + fprintf(stderr, "threshold epoch: %llu\n", interval_threshold); } if (!stop_after_interval) @@ -1047,8 +1040,6 @@ const enum PCap_format format) file_number++; su_count = 0; - ftime(&start); - int rotation_time_reached = 0; do { @@ -1075,28 +1066,15 @@ const enum PCap_format format) if (!write_to_pipe && !write_to_stdout) { - if (!begin_sec && !begin_usec) - { - begin_sec = curr_sec; - begin_usec = curr_usec; - begin_ts = convert_timestamp_ms(begin_sec, begin_usec, format); - } - else if (duration_per_file) + if (duration_per_file) { - curr_ts = convert_timestamp_ms(curr_sec, curr_usec, format); + curr_ts = convert_timestamp_micro(curr_sec, curr_usec, format); - currentdiff = (u32)curr_ts - begin_ts; - - if (currentdiff >= (1000.0 * duration_per_file)) + if (curr_ts >= interval_threshold) { - fprintf(stderr, "Time difference detected based on file contents: %d ms\n", currentdiff); + fprintf(stderr, "interval threshold triggered.\n"); set_timer(duration_per_file); break; - - } - else - { - currentdiff = 0; } } } @@ -1107,41 +1085,15 @@ const enum PCap_format format) || write_to_stdout ); - ftime(&stop); fclose(file); if (!write_to_pipe && !write_to_stdout) { if (rotation_time_reached && stop_after_interval) { - fprintf(stderr, "Stopped capturing when rotation time reached\n"); + fprintf(stderr, "stopped capturing when rotation time reached\n"); always_true = 0; } - else if (duration_per_file) - { - if (!currentdiff) - { - currentdiff = (int)(1000.0 * (stop.time - start.time) + (stop.millitm - start.millitm)); - fprintf(stderr, "Time difference detected based on file writing process: %d ms\n", currentdiff); - - error = currentdiff - (duration_per_file * 1000); - - fprintf(stderr, "Interval error %d ms\n", error); - - if (error > 0) - { - error = (int)(1.2 * error); - } - diff += error; - fprintf(stderr, "Total error %d ms\n", diff); - suggestion = 1000 * duration_per_file - diff; - //rawtime=flushtime; - fprintf(stderr, "Interval time set to %d ms\n", suggestion); - set_timer_milli(suggestion); - } - } - - } } } From ab583bb6068e05b3d1d9f78cb383f087a7e231c0 Mon Sep 17 00:00:00 2001 From: Hessam Jalali Date: Wed, 5 Oct 2016 02:37:58 +0330 Subject: [PATCH 15/20] dotnet cli added --- .gitignore | 271 +++++++- c/gth_apilib.c | 58 +- c/gth_client_xml_parse.c | 24 +- .../Corelatus/Corelatus.GTH/AssemblyInfo.cpp | 38 ++ .../Corelatus/Corelatus.GTH/Corelatus.GTH.cpp | 612 ++++++++++++++++++ .../Corelatus/Corelatus.GTH/Corelatus.GTH.h | 69 ++ .../Corelatus.GTH/Corelatus.GTH.vcxproj | 193 ++++++ .../Corelatus.GTH.vcxproj.filters | 133 ++++ .../Corelatus.GTH/CorelatusException.cpp | 8 + .../Corelatus.GTH/CorelatusException.h | 11 + .../Corelatus.GTH/DataConnection.cpp | 33 + .../Corelatus/Corelatus.GTH/DataConnection.h | 26 + .../Corelatus.GTH/DeviceAttribute.cpp | 30 + .../Corelatus/Corelatus.GTH/DeviceAttribute.h | 32 + .../Corelatus/Corelatus.GTH/DeviceReader.cpp | 39 ++ dotnet/Corelatus/Corelatus.GTH/DeviceReader.h | 20 + .../Corelatus/Corelatus.GTH/DeviceWriter.cpp | 22 + dotnet/Corelatus/Corelatus.GTH/DeviceWriter.h | 19 + dotnet/Corelatus/Corelatus.GTH/GTH.h | 5 + dotnet/Corelatus/Corelatus.GTH/IConnection.h | 18 + dotnet/Corelatus/Corelatus.GTH/Listener.cpp | 34 + dotnet/Corelatus/Corelatus.GTH/Listener.h | 39 ++ dotnet/Corelatus/Corelatus.GTH/ReadMe.txt | 38 ++ dotnet/Corelatus/Corelatus.GTH/Socket.c | 66 ++ dotnet/Corelatus/Corelatus.GTH/Socket.h | 6 + dotnet/Corelatus/Corelatus.GTH/Stdafx.cpp | 5 + dotnet/Corelatus/Corelatus.GTH/Stdafx.h | 7 + dotnet/Corelatus/Corelatus.GTH/ToneArgs.cpp | 9 + dotnet/Corelatus/Corelatus.GTH/ToneArgs.h | 20 + .../Corelatus/Corelatus.GTH/ToneHandler.cpp | 23 + dotnet/Corelatus/Corelatus.GTH/ToneHandler.h | 22 + dotnet/Corelatus/Corelatus.GTH/Utilities.cpp | 14 + dotnet/Corelatus/Corelatus.GTH/Utilities.h | 18 + dotnet/Corelatus/Corelatus.GTH/app.ico | Bin 0 -> 11001 bytes dotnet/Corelatus/Corelatus.GTH/app.rc | Bin 0 -> 2558 bytes dotnet/Corelatus/Corelatus.GTH/resource.h | 3 + dotnet/Corelatus/Corelatus.sln | 52 ++ dotnet/Corelatus/SaveToPcap/App.config | 6 + dotnet/Corelatus/SaveToPcap/Channel.cs | 8 + dotnet/Corelatus/SaveToPcap/Cmd.cs | 78 +++ dotnet/Corelatus/SaveToPcap/Config.cs | 14 + dotnet/Corelatus/SaveToPcap/EndianReader.cs | 48 ++ dotnet/Corelatus/SaveToPcap/Extensions.cs | 61 ++ dotnet/Corelatus/SaveToPcap/Mtp2Config.cs | 13 + dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs | 57 ++ dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs | 119 ++++ dotnet/Corelatus/SaveToPcap/Program.cs | 12 + .../SaveToPcap/Properties/AssemblyInfo.cs | 36 ++ dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj | 84 +++ dotnet/Corelatus/SaveToPcap/packages.config | 4 + 50 files changed, 2510 insertions(+), 47 deletions(-) create mode 100644 dotnet/Corelatus/Corelatus.GTH/AssemblyInfo.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj create mode 100644 dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters create mode 100644 dotnet/Corelatus/Corelatus.GTH/CorelatusException.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/CorelatusException.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/DataConnection.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/DataConnection.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/DeviceReader.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/DeviceWriter.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/DeviceWriter.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/GTH.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/IConnection.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/Listener.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/Listener.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/ReadMe.txt create mode 100644 dotnet/Corelatus/Corelatus.GTH/Socket.c create mode 100644 dotnet/Corelatus/Corelatus.GTH/Socket.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/Stdafx.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/Stdafx.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/ToneArgs.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/ToneArgs.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/ToneHandler.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/ToneHandler.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/Utilities.cpp create mode 100644 dotnet/Corelatus/Corelatus.GTH/Utilities.h create mode 100644 dotnet/Corelatus/Corelatus.GTH/app.ico create mode 100644 dotnet/Corelatus/Corelatus.GTH/app.rc create mode 100644 dotnet/Corelatus/Corelatus.GTH/resource.h create mode 100644 dotnet/Corelatus/Corelatus.sln create mode 100644 dotnet/Corelatus/SaveToPcap/App.config create mode 100644 dotnet/Corelatus/SaveToPcap/Channel.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Cmd.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Config.cs create mode 100644 dotnet/Corelatus/SaveToPcap/EndianReader.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Extensions.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Mtp2Config.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Program.cs create mode 100644 dotnet/Corelatus/SaveToPcap/Properties/AssemblyInfo.cs create mode 100644 dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj create mode 100644 dotnet/Corelatus/SaveToPcap/packages.config diff --git a/.gitignore b/.gitignore index 5e024fc..1b86e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,268 @@ -CVS -*.pyc -*.beam -*~ -.cvsignore -*.zip +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files *.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta *.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf *.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/ diff --git a/c/gth_apilib.c b/c/gth_apilib.c index e3333eb..e4de63d 100644 --- a/c/gth_apilib.c +++ b/c/gth_apilib.c @@ -188,7 +188,7 @@ void *checked_malloc(size_t size) void gth_event_handler(void *data, GTH_resp *resp) { GTH_resp *child; - GTH_api *api = data; + GTH_api *api = (GTH_api*)data; assert(api); assert(resp); @@ -284,16 +284,16 @@ int gth_connect(GTH_api *api, const char *address, const int verbose) // Helper for simple commands. static int single_arg_ok_response(GTH_api *api, - const char *template, + const char *tmpl, const char *arg) { char buffer[MAX_COMMAND]; assert(api); - assert(template); + assert(tmpl); assert(arg); - snprintf(buffer, MAX_COMMAND, template, arg); + snprintf(buffer, MAX_COMMAND, tmpl, arg); api_write(api, buffer); if (check_api_response(api, GTH_RESP_OK, 0)) { @@ -641,17 +641,17 @@ int gth_new_lapd_layer(GTH_api *api, { char command[MAX_COMMAND]; int result; - const char* template; + const char* tmpl; assert(ts > 0 && ts < 32); assert(!strcmp("network", side) || !strcmp("user", side)); - template = "" + tmpl = "" "" "" ""; - result = snprintf(command, MAX_COMMAND, template, side, sapi, + result = snprintf(command, MAX_COMMAND, tmpl, side, sapi, tei, ip, port, tag, span, ts, span, ts); assert(result < MAX_COMMAND); api_write(api, command); @@ -671,15 +671,15 @@ int gth_new_lapd_monitor(GTH_api *api, { char command[MAX_COMMAND]; int result; - const char* template; + const char* tmpl; assert(ts > 0 && ts < 32); - template = "" + tmpl = "" "" ""; - result = snprintf(command, MAX_COMMAND, template, ip, port, tag, span, ts); + result = snprintf(command, MAX_COMMAND, tmpl, ip, port, tag, span, ts); assert(result < MAX_COMMAND); api_write(api, command); result = recv_job_id(api, job_id); @@ -736,18 +736,18 @@ int gth_new_mtp2_monitor_opt(GTH_api *api, char sources[MAX_COMMAND]; char attributes[MAX_COMMAND]; int result; - const char* template; + const char* tmpl; assert(n_timeslots < 32 && n_timeslots > 0); result = kv_to_attributes(attributes, MAX_COMMAND, options, n_options); - template = "" + tmpl = "" "%s"; format_sources(span, timeslots, n_timeslots, sources); - result = snprintf(command, MAX_COMMAND, template, + result = snprintf(command, MAX_COMMAND, tmpl, attributes, ip, port, tag, sources); assert(result < MAX_COMMAND); api_write(api, command); @@ -767,17 +767,17 @@ int gth_new_player(GTH_api *api, int data_socket; char command[MAX_COMMAND]; int result; - const char* template; + const char* tmpl; assert(api); assert(span); assert(job_id); assert(timeslot > 0 && timeslot < 32); - template = "" + tmpl = "" ""; - result = snprintf(command, MAX_COMMAND, template, + result = snprintf(command, MAX_COMMAND, tmpl, api->my_ip, listen_port, span, timeslot); assert(result < MAX_COMMAND); api_write(api, command); @@ -800,18 +800,18 @@ int gth_new_recorder(GTH_api *api, int data_socket; char command[MAX_COMMAND]; int result; - const char* template; + const char* tmpl; assert(api); assert(span); assert(timeslot > 0 && timeslot < 32); assert(job_id); - template = "" + tmpl = "" "" ""; - result = snprintf(command, MAX_COMMAND, template, + result = snprintf(command, MAX_COMMAND, tmpl, span, timeslot, api->my_ip, listen_port); assert(result < MAX_COMMAND); api_write(api, command); @@ -830,14 +830,14 @@ int gth_new_tone_detector(GTH_api *api, char *job_id, GTH_tone_handler* handler) { - const char *template; + const char *tmpl; int result; char command[MAX_COMMAND]; - template = "" + tmpl = "" ""; - result = snprintf(command, MAX_COMMAND, template, span, timeslot); + result = snprintf(command, MAX_COMMAND, tmpl, span, timeslot); assert(result < MAX_COMMAND); api_write(api, command); result = recv_job_id(api, job_id); @@ -873,17 +873,17 @@ int gth_new_wide_recorder(GTH_api *api, int data_socket = gth_make_udp_socket(&portno); char command[MAX_COMMAND]; int result; - const char* template; + const char* tmpl; assert(api); assert(span); assert(job_id); - template = "" + tmpl = "" "" ""; - result = snprintf(command, MAX_COMMAND, template, + result = snprintf(command, MAX_COMMAND, tmpl, span, api->my_ip, portno); assert(result < MAX_COMMAND); api_write(api, command); @@ -1381,7 +1381,7 @@ static int query_single_resource(GTH_api *api, if (is_text_following_resource_query(name)) { int result; - char *text_buffer = checked_malloc(MAX_LOGFILE); + char *text_buffer = (char*)checked_malloc(MAX_LOGFILE); result = next_api_response(api, text_buffer, MAX_LOGFILE); if (result != 0) @@ -1392,13 +1392,13 @@ static int query_single_resource(GTH_api *api, } (*n_attributes)++; - *attributes = checked_malloc(sizeof(GTH_attribute) * *n_attributes); + *attributes = (GTH_attribute*)checked_malloc(sizeof(GTH_attribute) * *n_attributes); (*attributes)[*n_attributes - 1].key = "log_body"; (*attributes)[*n_attributes - 1].value = text_buffer; } else { - *attributes = checked_malloc(sizeof(GTH_attribute) * *n_attributes); + *attributes = (GTH_attribute*)checked_malloc(sizeof(GTH_attribute) * *n_attributes); } for (x = 0; x < resource->n_children; x++) { @@ -1446,7 +1446,7 @@ static int query_inventory(GTH_api *api, if (resp->type == GTH_RESP_STATE) { - *attributes = checked_malloc(sizeof(GTH_attribute) * resp->n_children); + *attributes =(GTH_attribute*) checked_malloc(sizeof(GTH_attribute) * resp->n_children); *n_attributes = resp->n_children; for (x = 0; x < resp->n_children; x++) { diff --git a/c/gth_client_xml_parse.c b/c/gth_client_xml_parse.c index 17cc299..2085cab 100644 --- a/c/gth_client_xml_parse.c +++ b/c/gth_client_xml_parse.c @@ -72,7 +72,7 @@ copy_to_new_add_null(const char *src, int len) { char *result; - result = checked_malloc(len + 1); + result = (char*)checked_malloc(len + 1); memcpy(result, src, len); result[len] = 0; @@ -84,7 +84,7 @@ copy_to_new_add_null(const char *src, int len) // Return: the number of characters that were in the string. static int scan_string(const char* string, GTH_token *token, const char end) { - char* endptr; + const char* endptr; int len; endptr = strchr(string, end); @@ -124,7 +124,7 @@ int gth_scan(const char *string, GTH_token **ret_tokens) size_t len; int max_token = 5; int tokens_used = 0; - GTH_token *start = checked_malloc(max_token * sizeof(GTH_token)); + GTH_token *start = (GTH_token*)checked_malloc(max_token * sizeof(GTH_token)); GTH_token *current = start; //---- @@ -132,7 +132,7 @@ int gth_scan(const char *string, GTH_token **ret_tokens) tokens_used = (current - start); if ( tokens_used == max_token) { max_token = max_token * 2; - start = checked_realloc(start, max_token * sizeof(GTH_token)); + start = (GTH_token*)checked_realloc(start, max_token * sizeof(GTH_token)); current = start + tokens_used; } @@ -164,7 +164,7 @@ int gth_scan(const char *string, GTH_token **ret_tokens) tokens_used = (current - start); if ( tokens_used == max_token) { max_token = max_token * 2; - start = checked_realloc(start, max_token * sizeof(GTH_token)); + start = (GTH_token*)checked_realloc(start, max_token * sizeof(GTH_token)); current = start + tokens_used; } @@ -300,7 +300,7 @@ static GTH_resp *resp_add_child(GTH_resp *resp, GTH_resp_type type) if (resp->n_children >= resp->allocated_children) { resp->allocated_children = resp->allocated_children * 2 + 3; - resp->children = checked_realloc(resp->children, + resp->children =(GTH_resp_struct*) checked_realloc(resp->children, resp->allocated_children * sizeof(GTH_resp)); } @@ -319,7 +319,7 @@ static void resp_add_attribute(GTH_resp *resp, char *key, char *value) if (resp->allocated_attributes <= resp->n_attributes) { resp->allocated_attributes = 2*resp->allocated_attributes + 2; - resp->attributes = checked_realloc(resp->attributes, + resp->attributes =(GTH_attribute*) checked_realloc(resp->attributes, resp->allocated_attributes * sizeof(GTH_attribute)); } @@ -334,7 +334,7 @@ static void resp_add_attribute(GTH_resp *resp, char *key, char *value) static GTH_token *parse(GTH_token *token, GTH_resp *resp); static GTH_token *attributes(GTH_token *token, GTH_resp *resp); static GTH_token *parse_inside_tag(GTH_token *token, char **text); -static enum Token_type name_to_token_type(const char* name); +static GTH_resp_type name_to_token_type(const char* name); void gth_free_resp(GTH_resp *resp); static int can_lookahead(const GTH_token *token, int n); @@ -348,7 +348,7 @@ GTH_resp *gth_parse(const char *string) { GTH_token *tokens; GTH_token *end; - GTH_resp *resp = checked_malloc(sizeof(GTH_resp)); + GTH_resp *resp = (GTH_resp*)checked_malloc(sizeof(GTH_resp)); GTH_resp *old; new_resp(resp, GTH_RESP_ERROR); @@ -381,7 +381,7 @@ static GTH_token *parse(GTH_token *token, GTH_resp *list_of_trees) GTH_token *name; GTH_token *slash; GTH_token *close; - char *tag_name; + const char *tag_name; GTH_resp *tree = 0; if (!can_lookahead(token, 2)) { @@ -484,7 +484,7 @@ static GTH_token *attributes(GTH_token *token, GTH_resp *resp) { } -static enum Token_type name_to_token_type(const char* name) +static GTH_resp_type name_to_token_type(const char* name) { if (!strcmp(name, "alarm")) return GTH_RESP_ALARM; if (!strcmp(name, "alert")) return GTH_RESP_ALERT; @@ -519,7 +519,7 @@ static enum Token_type name_to_token_type(const char* name) fprintf(stderr, "don't know what this is: %s\n", name); assert(!"unknown tag"); - return 0; // never reached + return (GTH_resp_type)0; // never reached } // Are there at least N tokens left to look at. diff --git a/dotnet/Corelatus/Corelatus.GTH/AssemblyInfo.cpp b/dotnet/Corelatus/Corelatus.GTH/AssemblyInfo.cpp new file mode 100644 index 0000000..8a8dd06 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/AssemblyInfo.cpp @@ -0,0 +1,38 @@ +#include "stdafx.h" + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly:AssemblyTitleAttribute(L"CorelatusGTH")]; +[assembly:AssemblyDescriptionAttribute(L"")]; +[assembly:AssemblyConfigurationAttribute(L"")]; +[assembly:AssemblyCompanyAttribute(L"")]; +[assembly:AssemblyProductAttribute(L"CorelatusGTH")]; +[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2016")]; +[assembly:AssemblyTrademarkAttribute(L"")]; +[assembly:AssemblyCultureAttribute(L"")]; + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the value or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly:AssemblyVersionAttribute("1.0.*")]; + +[assembly:ComVisible(false)]; + +[assembly:CLSCompliantAttribute(true)]; \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.cpp b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.cpp new file mode 100644 index 0000000..d6b4392 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.cpp @@ -0,0 +1,612 @@ +// This is the main DLL file. + +#include "Corelatus.GTH.h" +#include "DeviceReader.h" +#include "DeviceWriter.h" +#include "Socket.h" +#include "IConnection.h" +#include "Listener.h" +#include "DataConnection.h" + +#define MAX_BUFFER 4096 + +using namespace Corelatus::GTH; + + +Device^ Device::Connect(String^ addr){ + return Connect(addr, false); +} + +Device^ Device::Connect(String^ addr, bool verbose){ + + if (!init){ + win32_specific_startup(); + init = true; + } + + Device^ dev = gcnew Device(); + dev->ptr_addr = Marshal::StringToHGlobalAnsi(addr); + dev->api = new GTH_api(); + + int res = gth_connect(dev->api, (char*)dev->ptr_addr.ToPointer(), verbose); + + if (res != 0) + throw gcnew CorelatusException("Failed to connect to device."); + + dev->connected = true; + return dev; +} + +bool Device::WaitForReboot(String^ addr){ + IntPtr ptr_addr; + int res = -1; + try{ + ptr_addr = Marshal::StringToHGlobalAnsi(addr); + res = gth_wait_for_reboot((const char*)ptr_addr.ToPointer()); + } + finally{ + if (ptr_addr != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_addr); + } + return res == 0; +} + +void Device::SwitchTo(String^ addr, String^ system,bool verbose){ + IntPtr ptr_addr; + IntPtr ptr_system; + + try{ + ptr_addr = Marshal::StringToHGlobalAnsi(addr); + ptr_system = Marshal::StringToHGlobalAnsi(system); + + gth_switch_to((const char*)ptr_addr.ToPointer(), (const char*)ptr_system.ToPointer(),verbose); + } + finally{ + if (ptr_addr != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_addr); + if (ptr_system != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_system); + } +} + +String^ Device::QueryResourceAttribute(String^ name, String^ key){ + + IntPtr ptr_name; + IntPtr ptr_key; + char buffer[MAX_BUFFER]; + + try{ + ptr_name = Marshal::StringToHGlobalAnsi(name); + ptr_key = Marshal::StringToHGlobalAnsi(key); + + int res = gth_query_resource_attribute(api, (const char*)ptr_name.ToPointer(), (const char*)ptr_key.ToPointer(), buffer, MAX_BUFFER); + if (res != 0) + throw gcnew CorelatusException(String::Format("Failed to read attribute {0}.{1}", name, key)); + + return gcnew String(buffer); + } + finally{ + if (ptr_name != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_name); + if (ptr_key != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_key); + } +} + +bool Device::WaitForMessageEnded(String^ jobId){ + + IntPtr ptr_jobId; + int res = -1; + try{ + ptr_jobId=Marshal::StringToHGlobalAnsi(jobId); + res=gth_wait_for_message_ended(api, (const char*)ptr_jobId.ToPointer()); + } + finally{ + if (ptr_jobId != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_jobId); + } + return res == 0; +} + +bool Device::Delete(String^ jobId){ + + IntPtr ptr_jobId; + int res = -1; + try{ + ptr_jobId = Marshal::StringToHGlobalAnsi(jobId); + res=gth_delete(api, (const char*)ptr_jobId.ToPointer()); + } + finally{ + if (ptr_jobId != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_jobId); + } + return res == 0; +} + +bool Device::Disable(String^ resource){ + + IntPtr ptr_resource; + int res = -1; + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + res=gth_disable(api, (const char*)ptr_resource.ToPointer()); + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return res == 0; +} + +bool Device::Enable(String^ resource, IEnumerable ^attributes){ + IntPtr ptr_resource; + int res = -1; + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + + GTH_attribute* native_atts = 0; + + int count = attributes == nullptr ? 0 : Enumerable::Count(attributes); + if (count > 0){ + native_atts = new GTH_attribute[count]; + + int i = 0; + for each (DeviceAttribute^ att in attributes) + { + native_atts[i] = att->ToNative(); + i++; + } + } + res = gth_enable(api, (const char*)ptr_resource.ToPointer(), native_atts, count); + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return res == 0; +} + +bool Device::Install(String^ name, String^ type, array ^data){ + IntPtr ptr_name; + IntPtr ptr_type; + IntPtr ptr_data; + int res = -1; + + try{ + ptr_name = Marshal::StringToHGlobalAnsi(name); + ptr_type = Marshal::StringToHGlobalAnsi(type); + ptr_data = Marshal::AllocHGlobal(data->Length); + Marshal::Copy(data, 0, ptr_data, data->Length); + + res = gth_install(api, (const char*)ptr_name.ToPointer(), (const char*)ptr_type.ToPointer(), (const char*)ptr_data.ToPointer(), data->Length); + } + finally{ + if (ptr_name != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_name); + if (ptr_type != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_type); + if (ptr_data != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_data); + } + return res == 0; +} + +bool Device::Map(String^ resource, String^% name){ + IntPtr ptr_resource; + char buff_name[MAX_BUFFER]; + + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + int res = gth_map(api, (const char*)ptr_resource.ToPointer(), buff_name, MAX_BUFFER); + + if (res != 0){ + name = nullptr; + return false; + } + + name = gcnew String(buff_name); + return true; + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return false; +} + +bool Device::Unmap(String^ resource){ + IntPtr ptr_resource; + int res = -1; + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + res = gth_unmap(api, (const char*)ptr_resource.ToPointer()); + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return res == 0; +} + +bool Device::NewConnection(String^ srcSpan, int srcTs, String^dstSpan, int dstTs, String^% jobId){ + IntPtr ptr_srcSpan; + IntPtr ptr_dstSpan; + char buff_jobId[MAX_BUFFER]; + + try{ + ptr_srcSpan = Marshal::StringToHGlobalAnsi(srcSpan); + ptr_dstSpan = Marshal::StringToHGlobalAnsi(dstSpan); + + int res = gth_new_connection(api, (const char*)ptr_srcSpan.ToPointer(), srcTs, (const char*)ptr_dstSpan.ToPointer(), dstTs, buff_jobId); + if (res != 0){ + jobId == nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_srcSpan != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_srcSpan); + if (ptr_dstSpan != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_dstSpan); + } + return false; +} + +void Device::Nop(){ + gth_nop(api); +} + +bool Device::Set(String^ resource, IEnumerable ^attributes){ + IntPtr ptr_resource; + int res = -1; + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + int count = Enumerable::Count(attributes); + GTH_attribute* native_atts = new GTH_attribute[count]; + + int i = 0; + for each (DeviceAttribute^ att in attributes) + { + native_atts[i] = att->ToNative(); + i++; + } + + res = gth_set(api, (const char*)ptr_resource.ToPointer(), native_atts, count); + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return res == 0; +} + +bool Device::Set(String^ resource, DeviceAttribute ^attribute){ + IntPtr ptr_resource; + int res = -1; + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + GTH_attribute native_att = attribute->ToNative(); + + res = gth_set_single(api, (const char*)ptr_resource.ToPointer(), native_att.key,native_att.value); + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return res == 0; +} + +bool Device::Reset(String^ resource){ + IntPtr ptr_resource; + int res = -1; + try{ + ptr_resource = Marshal::StringToHGlobalAnsi(resource); + res = gth_reset(api, (const char*)ptr_resource.ToPointer()); + } + finally{ + if (ptr_resource != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_resource); + } + return res == 0; +} + +String^ Device::MyIpAddress(){ + return gcnew String(gth_my_ip_address(api)); +} + +GTH_api* Device::NativeApi(){ + return api; +} + +IConnection^ Device::Listen(){ + int port; + int socket=gth_make_listen_socket(&port); + + return gcnew Listener(socket, port, this); +} + +IConnection^ Device::ListenUdp(){ + int port; + int socket = gth_make_udp_socket(&port); + + return gcnew Listener(socket, port, this); +} + +IConnection^ Device::WaitForAccept(IConnection^ listener){ + + int socket = gth_wait_for_accept(listener->NativeHandle()); + return gcnew DataConnection(socket); +} + +bool Device::NewCasR2MfcDetector(int tag, String^ span, int timeslot, IConnection^ connection, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + Listener^ listener = (Listener^)connection; + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_cas_r2_mfc_detector(api, tag, (const char*)ptr_span.ToPointer(), timeslot, buff_jobId, api->my_ip, listener->Port); + + if (res != 0){ + jobId = nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return false; +} + +bool Device::NewCasR2LineSigMonitor(int tag, String^ span, int timeslot, IConnection^ connection, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + Listener^ listener = (Listener^)connection; + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_cas_r2_mfc_detector(api, tag, (const char*)ptr_span.ToPointer(), timeslot, buff_jobId, api->my_ip, listener->Port); + + if (res != 0){ + jobId = nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return false; +} + +bool Device::NewLapdLayer(int tag, String^ span, int timeslot, String^ side, int sapi, int tei, IConnection^ connection, String^% jobId){ + IntPtr ptr_span; + IntPtr ptr_side; + char buff_jobId[MAX_BUFFER]; + try{ + Listener^ listener = (Listener^)connection; + + ptr_span = Marshal::StringToHGlobalAnsi(span); + ptr_side = Marshal::StringToHGlobalAnsi(side); + + int res = gth_new_lapd_layer(api, tag, (const char*)ptr_span.ToPointer(), timeslot, (const char*)ptr_side.ToPointer(),sapi,tei, buff_jobId, api->my_ip, listener->Port); + + if (res != 0){ + jobId = nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + if (ptr_side != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_side); + } + return false; +} + +bool Device::NewLapdMonitor(int tag, String^ span, int timeslot, IConnection^ connection, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + Listener^ listener = (Listener^)connection; + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_lapd_monitor(api, tag, (const char*)ptr_span.ToPointer(), timeslot, buff_jobId, api->my_ip, listener->Port); + + if (res != 0){ + jobId = nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return false; +} + +bool Device::NewMtp2Monitor(int tag, String^ span, array^ timeslot, IConnection^ connection, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + Listener^ listener = (Listener^)connection; + + ptr_span = Marshal::StringToHGlobalAnsi(span); + pin_ptr ptr_timeslot = ×lot[0]; + + int res = gth_new_mtp2_monitor(api, tag, (const char*)ptr_span.ToPointer(), ptr_timeslot, timeslot->Length, buff_jobId, api->my_ip, listener->Port); + + if (res != 0){ + jobId = nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return false; +} + +bool Device::NewMtp2Monitor(int tag, String^ span, array^ timeslot, IConnection^ connection, IEnumerable ^attributes, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + Listener^ listener = (Listener^)connection; + + ptr_span = Marshal::StringToHGlobalAnsi(span); + pin_ptr ptr_timeslot = ×lot[0]; + + int count = Enumerable::Count(attributes); + GTH_attribute* native_atts = new GTH_attribute[count]; + + int i = 0; + for each (DeviceAttribute^ att in attributes) + { + native_atts[i] = att->ToNative(); + i++; + } + + int res = gth_new_mtp2_monitor_opt(api, tag, (const char*)ptr_span.ToPointer(), ptr_timeslot, timeslot->Length, buff_jobId, api->my_ip, listener->Port, native_atts, count); + + if (res != 0){ + jobId = nullptr; + return false; + } + + jobId = gcnew String(buff_jobId); + return true; + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return false; +} + +DeviceWriter^ Device::NewPlayer(String^ span, int timeslot, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_player(api,(const char*)ptr_span.ToPointer(), timeslot,buff_jobId); + + if (res < 0){ + jobId = nullptr; + return nullptr; + } + + jobId = gcnew String(buff_jobId); + return gcnew DeviceWriter(res,0); + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return nullptr; +} + +DeviceReader^ Device::NewRecorder(String^ span, int timeslot, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_recorder(api, (const char*)ptr_span.ToPointer(), timeslot, buff_jobId); + + if (res < 0){ + jobId = nullptr; + return nullptr; + } + + jobId = gcnew String(buff_jobId); + return gcnew DeviceReader(res,0); + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return nullptr; +} + +DeviceReader^ Device::NewRecorder(String^ span, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_wide_recorder(api, (const char*)ptr_span.ToPointer(), buff_jobId); + + if (res < 0){ + jobId = nullptr; + return nullptr; + } + + jobId = gcnew String(buff_jobId); + return gcnew DeviceReader(res, 0); + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return nullptr; +} + +DeviceReader^ Device::NewToneDetector(String^ span, int timeslot,ToneHandler^ handle, String^% jobId){ + IntPtr ptr_span; + char buff_jobId[MAX_BUFFER]; + try{ + + ptr_span = Marshal::StringToHGlobalAnsi(span); + int res = gth_new_tone_detector(api, (const char*)ptr_span.ToPointer(), timeslot, buff_jobId, (GTH_tone_handler*) handle->native_ptr().ToPointer()); + + if (res < 0){ + jobId = nullptr; + return nullptr; + } + + jobId = gcnew String(buff_jobId); + return gcnew DeviceReader(res, 0); + } + finally{ + if (ptr_span != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_span); + } + return nullptr; +} + +Device::~Device(){ + try{ + if (!connected) + return; + + int res = gth_bye(api); + if (res != 0) + throw gcnew CorelatusException("Failed to close the device."); + } + finally{ + if (ptr_addr != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_addr); + } +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.h b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.h new file mode 100644 index 0000000..1de8590 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.h @@ -0,0 +1,69 @@ +// Corelatus.GTH.h + +#pragma once + +#include "GTH.h" +#include "CorelatusException.h" +#include "DeviceAttribute.h" +#include "IConnection.h" +#include "ToneHandler.h" + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Runtime::InteropServices; +using namespace System::Linq; + +namespace Corelatus { + namespace GTH{ + + public ref class Device:IDisposable + { + private: + IntPtr ptr_addr; + GTH_api* api; + bool connected; + static bool init; + public: + static Device^ Connect(String^ addr); + static Device^ Connect(String^ addr, bool verbose); + static bool WaitForReboot(String^ addr); + static void SwitchTo(String^ addr, String^ mode, bool verbose); + + String^ QueryResourceAttribute(String^ name, String^ key); + bool WaitForMessageEnded(String^ jobId); + bool Delete(String^ jobId); + bool Disable(String^ resource); + bool Enable(String^ resource, IEnumerable ^attributes); + bool Install(String^ name, String^ type, array ^data); + bool Map(String^ resource,[Out] String^% name); + bool Unmap(String^ resource); + + void Nop(); + bool Set(String^ resource, IEnumerable ^attributes); + bool Set(String^ resource, DeviceAttribute ^attribute); + bool Reset(String^ resource); + String^ MyIpAddress(); + IConnection^ Listen(); + IConnection^ ListenUdp(); + IConnection^ WaitForAccept(IConnection^ listener); + + bool NewConnection(String^ srcSpan, int srcTs, String^ dstSpan, int dstTs, String^% jobId); + bool NewCasR2MfcDetector(int tag, String^ span, int timeslot, IConnection^ listener, String^% jobId); + bool NewCasR2LineSigMonitor(int tag, String^ span, int timeslot, IConnection^ listener, String^% jobId); + bool NewLapdLayer(int tag, String^ span, int timeslot, String^ side,int sapi, int tei, IConnection^ listener, String^% jobId); + bool NewLapdMonitor(int tag, String^ span, int timeslot, IConnection^ listener, String^% jobId); + bool NewMtp2Monitor(int tag, String^ span, array^ timeslot, IConnection^ listener, String^% jobId); + bool NewMtp2Monitor(int tag, String^ span, array^ timeslot, IConnection^ listener,IEnumerable ^attributes, String^% jobId); + + DeviceWriter^ NewPlayer(String^ span, int timeslot, String^% jobId); + DeviceReader^ NewRecorder(String^ span, int timeslot, String^% jobId); + DeviceReader^ NewRecorder(String^ span, String^% jobId); + DeviceReader^ NewToneDetector(String^ span, int timeslot, ToneHandler^ handle, String^% jobId); + + + ~Device(); + internal: + GTH_api* NativeApi(); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj new file mode 100644 index 0000000..ae258ea --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj @@ -0,0 +1,193 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {6836D52D-2F3E-4568-BB02-9F2D8296CF89} + v4.5 + ManagedCProj + CorelatusGTH + + + + DynamicLibrary + true + v120 + true + Unicode + + + DynamicLibrary + true + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + CompileAsCpp + + + true + ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + CompileAsCpp + + + true + ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + Use + + + true + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + NotUsing + CompileAsCpp + + + true + ws2_32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters new file mode 100644 index 0000000..e80c095 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters @@ -0,0 +1,133 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/CorelatusException.cpp b/dotnet/Corelatus/Corelatus.GTH/CorelatusException.cpp new file mode 100644 index 0000000..067a695 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/CorelatusException.cpp @@ -0,0 +1,8 @@ +#include "stdafx.h" +#include "CorelatusException.h" + +using namespace Corelatus; + +CorelatusException::CorelatusException(String^ message) :Exception(message) +{ +} diff --git a/dotnet/Corelatus/Corelatus.GTH/CorelatusException.h b/dotnet/Corelatus/Corelatus.GTH/CorelatusException.h new file mode 100644 index 0000000..4356e30 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/CorelatusException.h @@ -0,0 +1,11 @@ +#pragma once + +using namespace System; + +namespace Corelatus{ + public ref class CorelatusException :Exception + { + public: + CorelatusException(String^ message); + }; +} diff --git a/dotnet/Corelatus/Corelatus.GTH/DataConnection.cpp b/dotnet/Corelatus/Corelatus.GTH/DataConnection.cpp new file mode 100644 index 0000000..2620603 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DataConnection.cpp @@ -0,0 +1,33 @@ + +#include "Socket.h" +#include "DataConnection.h" + +using namespace Corelatus::GTH; + +DataConnection::DataConnection(int descriptor){ + this->descriptor = descriptor; +} + +DataConnection::~DataConnection(){ + close(descriptor); +} + +int DataConnection::NativeHandle(){ + return descriptor; +} + +DeviceReader^ DataConnection::GetReader(int flags){ + return gcnew DeviceReader(descriptor, flags); +} + +DeviceReader^ DataConnection::GetReader(){ + return GetReader(0); +} + +DeviceWriter^ DataConnection::GetWriter(int flags){ + return gcnew DeviceWriter(descriptor, flags); +} + +DeviceWriter^ DataConnection::GetWriter(){ + return GetWriter(0); +} diff --git a/dotnet/Corelatus/Corelatus.GTH/DataConnection.h b/dotnet/Corelatus/Corelatus.GTH/DataConnection.h new file mode 100644 index 0000000..8b47c49 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DataConnection.h @@ -0,0 +1,26 @@ +#pragma once + +#include "Corelatus.GTH.h" +#include "DeviceReader.h" +#include "DeviceWriter.h" +#include "IConnection.h" + +namespace Corelatus{ + namespace GTH{ + public ref class DataConnection :IConnection, IDisposable + { + private: + int descriptor; + public: + virtual DeviceReader^ GetReader(); + virtual DeviceWriter^ GetWriter(); + virtual DeviceReader^ GetReader(int flags); + virtual DeviceWriter^ GetWriter(int flags); + virtual int NativeHandle(); + + internal: + DataConnection(int descriptor); + ~DataConnection(); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.cpp b/dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.cpp new file mode 100644 index 0000000..f8207aa --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.cpp @@ -0,0 +1,30 @@ +#include "stdafx.h" +#include "DeviceAttribute.h" + +using namespace Corelatus::GTH; +using namespace System::Runtime::InteropServices; + +DeviceAttribute::DeviceAttribute(String^ key,String^ value) +{ + this->key = key; + this->value = value; + + this->ptr_key = Marshal::StringToHGlobalAnsi(key); + this->ptr_value = Marshal::StringToHGlobalAnsi(value); +} + +DeviceAttribute::~DeviceAttribute(){ + if (ptr_key != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_key); + + if (ptr_value != IntPtr::Zero) + Marshal::FreeHGlobal(ptr_value); +} + +GTH_attribute DeviceAttribute::ToNative(){ + + GTH_attribute att; + att.key = (char*)ptr_key.ToPointer(); + att.value = (char*)ptr_value.ToPointer(); + return att; +} diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.h b/dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.h new file mode 100644 index 0000000..80c427f --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceAttribute.h @@ -0,0 +1,32 @@ +#pragma once + +#include "GTH.h" +using namespace System; + +namespace Corelatus{ + namespace GTH{ + public ref class DeviceAttribute :IDisposable + { + private: + String^ key; + String^ value; + IntPtr ptr_key; + IntPtr ptr_value; + public: + property String^ Key{ + String^ get(){ + return key; + } + } + property String^ Value{ + String^ get(){ + return value; + } + } + DeviceAttribute(String^ key, String^ value); + ~DeviceAttribute(); + internal: + GTH_attribute ToNative(); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp b/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp new file mode 100644 index 0000000..22f7f11 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp @@ -0,0 +1,39 @@ +#include "DeviceReader.h" + +#include "GTH.h" +#include "Socket.h" +#include "CorelatusException.h" + +using namespace Corelatus::GTH; + +DeviceReader::DeviceReader(int descriptor, int flags) +{ + this->descriptor = descriptor; + this->flags = flags; +} + +DeviceReader::~DeviceReader(){ + close(descriptor); +} + +int DeviceReader::Read(array ^buffer, int offset, int length){ + + pin_ptr ptr_buff = &buffer[offset]; + int res = rcv(descriptor, (char*)ptr_buff, length, flags); + return res; +} + +void DeviceReader::ReadExact(array ^buffer, int offset, int length){ + + pin_ptr ptr_buff = &buffer[offset]; + size_t this_time; + + while (length > 0) { + this_time = rcv(descriptor, (char*)ptr_buff, length, flags); + if (this_time <= 0) + throw gcnew CorelatusException("failed to read from device."); + + length -= this_time; + offset += this_time; + } +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceReader.h b/dotnet/Corelatus/Corelatus.GTH/DeviceReader.h new file mode 100644 index 0000000..c8b12fa --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceReader.h @@ -0,0 +1,20 @@ +#pragma once +using namespace System; + +namespace Corelatus{ + namespace GTH { + public ref class DeviceReader:IDisposable + { + private: + int descriptor; + int flags; + public: + int Read(array ^buffer, int offset, int length); + void ReadExact(array ^buffer, int offset, int length); + ~DeviceReader(); + internal: + DeviceReader(int descriptor, int flags); + }; +} +} + diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceWriter.cpp b/dotnet/Corelatus/Corelatus.GTH/DeviceWriter.cpp new file mode 100644 index 0000000..542eb38 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceWriter.cpp @@ -0,0 +1,22 @@ +#include "DeviceWriter.h" + +#include "Socket.h" + +using namespace Corelatus::GTH; + +DeviceWriter::DeviceWriter(int descriptor, int flags) +{ + this->descriptor = descriptor; + this->flags = flags; +} + +DeviceWriter::~DeviceWriter(){ + close(descriptor); +} + +int DeviceWriter::Write(array ^buffer, int offset, int length){ + + pin_ptr ptr_buff = &buffer[offset]; + int res = snd(descriptor, (const char*)ptr_buff, length, flags); + return res; +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceWriter.h b/dotnet/Corelatus/Corelatus.GTH/DeviceWriter.h new file mode 100644 index 0000000..76170ae --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceWriter.h @@ -0,0 +1,19 @@ +#pragma once +using namespace System; + +namespace Corelatus{ + namespace GTH { + public ref class DeviceWriter :IDisposable + { + private: + int descriptor; + int flags; + public: + int Write(array ^buffer, int offset, int length); + ~DeviceWriter(); + internal: + DeviceWriter(int descriptor, int flags); + }; + } +} + diff --git a/dotnet/Corelatus/Corelatus.GTH/GTH.h b/dotnet/Corelatus/Corelatus.GTH/GTH.h new file mode 100644 index 0000000..8165be5 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/GTH.h @@ -0,0 +1,5 @@ +#pragma once + +#include "..\..\..\c\gth_apilib.h" +#include "..\..\..\c\gth_win32_compat.h" +#include "..\..\..\c\gth_client_xml_parse.h" \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/IConnection.h b/dotnet/Corelatus/Corelatus.GTH/IConnection.h new file mode 100644 index 0000000..1d146ec --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/IConnection.h @@ -0,0 +1,18 @@ +#pragma once + +#include "DeviceReader.h" +#include "DeviceWriter.h" + +namespace Corelatus{ + namespace GTH{ + public interface class IConnection + { + public: + DeviceReader^ GetReader(); + DeviceWriter^ GetWriter(); + DeviceReader^ GetReader(int flags); + DeviceWriter^ GetWriter(int flags); + int NativeHandle(); + }; + } +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/Listener.cpp b/dotnet/Corelatus/Corelatus.GTH/Listener.cpp new file mode 100644 index 0000000..bc6fa81 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Listener.cpp @@ -0,0 +1,34 @@ + +#include "Socket.h" +#include "Listener.h" + +using namespace Corelatus::GTH; + +Listener::Listener(int descriptor, int port, Device^ owner){ + this->descriptor = descriptor; + this->port = port; + this->device = owner; +} +Listener::~Listener(){ + close(descriptor); +} + +int Listener::NativeHandle(){ + return descriptor; +} + +DeviceReader^ Listener::GetReader(int flags){ + return gcnew DeviceReader(descriptor, flags); +} + +DeviceReader^ Listener::GetReader(){ + return GetReader(0); +} + +DeviceWriter^ Listener::GetWriter(int flags){ + return gcnew DeviceWriter(descriptor, flags); +} + +DeviceWriter^ Listener::GetWriter(){ + return GetWriter(0); +} diff --git a/dotnet/Corelatus/Corelatus.GTH/Listener.h b/dotnet/Corelatus/Corelatus.GTH/Listener.h new file mode 100644 index 0000000..9ce7fa3 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Listener.h @@ -0,0 +1,39 @@ +#pragma once + +#include "Corelatus.GTH.h" +#include "DeviceReader.h" +#include "DeviceWriter.h" +#include "IConnection.h" + +namespace Corelatus{ + namespace GTH{ + public ref class Listener :IConnection, IDisposable + { + private: + int descriptor; + int port; + Device^ device; + public: + virtual DeviceReader^ GetReader(); + virtual DeviceWriter^ GetWriter(); + virtual DeviceReader^ GetReader(int flags); + virtual DeviceWriter^ GetWriter(int flags); + virtual int NativeHandle(); + + property Device^ Owner{ + Device^ get(){ + return device; + } + } + + property int Port{ + int get(){ + return port; + } + } + internal: + Listener(int descriptor, int port, Device^ owner); + ~Listener(); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt b/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt new file mode 100644 index 0000000..9265694 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt @@ -0,0 +1,38 @@ +======================================================================== + DYNAMIC LINK LIBRARY : Corelatus.GTH Project Overview +======================================================================== + +AppWizard has created this Corelatus.GTH DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your Corelatus.GTH application. + +Corelatus.GTH.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Corelatus.GTH.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Corelatus.GTH.cpp + This is the main DLL source file. + +Corelatus.GTH.h + This file contains a class declaration. + +AssemblyInfo.cpp + Contains custom attributes for modifying assembly metadata. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/dotnet/Corelatus/Corelatus.GTH/Socket.c b/dotnet/Corelatus/Corelatus.GTH/Socket.c new file mode 100644 index 0000000..956bd32 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Socket.c @@ -0,0 +1,66 @@ +#include "Socket.h" + +#include +#include "GTH.h" + +#include + +static int max_arg(int a, int b); + +int close(int handle){ + return closesocket(handle); +} + +int snd(int handle, const char* data, int len, int flags){ + return send(handle, data, len, flags); +} + +int rcv(int handle, char* data, int len, int flags){ + return recv(handle, data, len, flags); +} + +static int +max_arg(int a, int b) +{ + return (a > b) ? a : b; +} + +int wait_for_packet(void* ptr_api, int data_socket) +{ + GTH_api* api = (GTH_api*)ptr_api; + + fd_set fds; + int result; + int nfds = max_arg(api->fd, data_socket) + 1; + + FD_ZERO(&fds); + + for (;;) + { + struct timeval tv = { 1, 0 }; + FD_SET(api->fd, &fds); + FD_SET(data_socket, &fds); + + result = select(nfds, &fds, 0, 0, &tv); + + if (result < 0) + { + return -1; //failed + } + + if (result == 0) + { + return 0; + } + + if (FD_ISSET(api->fd, &fds)) + { + gth_nop(api); + } + + if (FD_ISSET(data_socket, &fds)) + { + return 1; + } + } +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/Socket.h b/dotnet/Corelatus/Corelatus.GTH/Socket.h new file mode 100644 index 0000000..b334f7a --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Socket.h @@ -0,0 +1,6 @@ +#pragma once + +int close(int handle); +int snd(int handle, const char* data, int len, int flags); +int rcv(int handle, char* data, int len, int flags); +int wait_for_packet(void *api, int data_socket); \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/Stdafx.cpp b/dotnet/Corelatus/Corelatus.GTH/Stdafx.cpp new file mode 100644 index 0000000..5f94d28 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Stdafx.cpp @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// Corelatus.GTH.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/dotnet/Corelatus/Corelatus.GTH/Stdafx.h b/dotnet/Corelatus/Corelatus.GTH/Stdafx.h new file mode 100644 index 0000000..3cc4c24 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Stdafx.h @@ -0,0 +1,7 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + + diff --git a/dotnet/Corelatus/Corelatus.GTH/ToneArgs.cpp b/dotnet/Corelatus/Corelatus.GTH/ToneArgs.cpp new file mode 100644 index 0000000..0193430 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/ToneArgs.cpp @@ -0,0 +1,9 @@ +#include "stdafx.h" +#include "ToneArgs.h" + +using namespace Corelatus::GTH; + +ToneArgs::ToneArgs(String^ name) +{ + this->name = name; +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/ToneArgs.h b/dotnet/Corelatus/Corelatus.GTH/ToneArgs.h new file mode 100644 index 0000000..e15eede --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/ToneArgs.h @@ -0,0 +1,20 @@ +#pragma once + +using namespace System; + +namespace Corelatus{ + namespace GTH{ + public ref class ToneArgs :EventArgs + { + private: + String^ name; + public: + property String^ Name{ + String^ get(){ + return name; + } + } + ToneArgs(String^ name); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/ToneHandler.cpp b/dotnet/Corelatus/Corelatus.GTH/ToneHandler.cpp new file mode 100644 index 0000000..9e1896f --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/ToneHandler.cpp @@ -0,0 +1,23 @@ +#include "stdafx.h" +#include "ToneHandler.h" + +using namespace System::Runtime::InteropServices; +using namespace System::Reflection; +using namespace Corelatus::GTH; + +void ToneHandler::native_handle(const char *name, const int length) +{ + ToneArgs^ args = gcnew ToneArgs(gcnew String(name)); + ToneDetected(this, args); +} + +ToneHandler::ToneHandler(){ + + Type^ type = this->GetType(); + MethodInfo^ mi = type->GetMethod("native_handle", BindingFlags::NonPublic | BindingFlags::Instance); + del = Delegate::CreateDelegate(type, mi); +} + +IntPtr ToneHandler::native_ptr(){ + return Marshal::GetFunctionPointerForDelegate(del); +} \ No newline at end of file diff --git a/dotnet/Corelatus/Corelatus.GTH/ToneHandler.h b/dotnet/Corelatus/Corelatus.GTH/ToneHandler.h new file mode 100644 index 0000000..f1c1012 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/ToneHandler.h @@ -0,0 +1,22 @@ +#pragma once + +#include "ToneArgs.h" + +using namespace System; + +namespace Corelatus{ + namespace GTH{ + public ref class ToneHandler + { + private: + Delegate^ del; + public: + event EventHandler^ ToneDetected; + ToneHandler(); + + internal: + void native_handle(const char *name, const int length); + IntPtr native_ptr(); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/Utilities.cpp b/dotnet/Corelatus/Corelatus.GTH/Utilities.cpp new file mode 100644 index 0000000..c70c6cf --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Utilities.cpp @@ -0,0 +1,14 @@ +#include "stdafx.h" +#include "Utilities.h" +#include "Socket.h" +#include "CorelatusException.h" + +using namespace Corelatus::GTH; + +bool Utilities::WaitForPacket(Device^ device, IConnection^ connection){ + int res = wait_for_packet(device->NativeApi(), connection->NativeHandle()); + if (res == -1) + throw gcnew CorelatusException("waiting on packet failed, connection closed abruptly."); + + return res > 0; +} diff --git a/dotnet/Corelatus/Corelatus.GTH/Utilities.h b/dotnet/Corelatus/Corelatus.GTH/Utilities.h new file mode 100644 index 0000000..9287cb4 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/Utilities.h @@ -0,0 +1,18 @@ +#pragma once + +#include "Corelatus.GTH.h" +#include "IConnection.h" + +using namespace System::Runtime::CompilerServices; + +namespace Corelatus{ + namespace GTH{ + [ExtensionAttribute] + public ref class Utilities abstract sealed + { + public: + [ExtensionAttribute] + static bool WaitForPacket(Device^ device, IConnection^ connection); + }; + } +} diff --git a/dotnet/Corelatus/Corelatus.GTH/app.ico b/dotnet/Corelatus/Corelatus.GTH/app.ico new file mode 100644 index 0000000000000000000000000000000000000000..d06d92b763b573936ea7ee8f9dde001bcd66128f GIT binary patch literal 11001 zcmZQzU}RutP*4y6(ku)wm>3w!7#J7?1R#73Mh1pBW(J@<15loWVFd>RLmLZ79>ULH zWnj?b1!@2SMg|3jV4&J*LNN6T3@d=@UW&rhD==gL^-fe{V9)@nR{&xMAO_hB20**9 zg9Zi$AYy1}fKWgZ$OPgBh64u<044r|5ySugAQlhBkO+W!@Pl#`@c%yww;aev z);<#WC;@;aJSdb$4o)m=LeYz?g^*fm%ERmhrE_2w0H<|WI&Z*f5l{vs2~5{u3P=K( zB&Bnhz270hUjH2;Kt2sK2aSf=19UAIkdf73TETf0wLAb8G9bVLp}-^~kOW~MaB^~D z`1t+lFzshIQjnswhH2NBjlhq!sd z33H7nSLDt;B=_S*Z^-i}W%pNn@l!{0@q_)A>$l2XR&J1-{*v*43}b@- z|Lc@Jz}@$_;&rt+Lks7iLAjTi>+1h4Q$H}{_Ft=C`?whnv5X=bhrqU%jN5;gRxzdQ zWKi%S8ok+bt;(mLA#DfII(*O)FoOGld!B-lK<;s+r-2|rPgg&ebxsLQpr(rg5IX=d zXs8wh8bD)HqhL^l0B~6A|0w?UA2`fMSBxI!gT;Q}Q0ISIVwgX1`Ja|{gUlYaACk^T z!ymQWgQbhn^f#LSX_*FK>1;Irjpje(GyqE%^rDgN2C?a7FU+1%`?05gSoqMI9&F){ z?w*mtA5@*e0dNd#sslvR(|VY_s8cKoU?(^rF9o5Jqo|Rd$t@FLc7ybj+O`4d8PyLd dtA|7Qk&}jy<9{Ia!`wj*O=&i!q;vx51pvcOoFo7M literal 0 HcmV?d00001 diff --git a/dotnet/Corelatus/Corelatus.GTH/app.rc b/dotnet/Corelatus/Corelatus.GTH/app.rc new file mode 100644 index 0000000000000000000000000000000000000000..eab43064f13cd0a8912887c2c7299ddb6d7d2240 GIT binary patch literal 2558 zcmds(T~8B16o%hx6aT}cz0qh|kt;8OHl(p2u|ObcVzjun$-0o1ioYIx-q}uzY&RON zHfA$lXU?2CAMZJ{zwW#0D(FZvO*GfF7PL&a(9WSPwA5$itPb>wFX)@Ts-VrG-!fi7 zn=|^{lG%iLU}b4D-N4h)b3NmhZXDZC3wCq3uOe@&a=xRfT9Ml)+mSDe=PY|qCmQKg zXXO<`@Kh{u}P)77e+J`b^ZYfCz>(RWgv~!7P?33(2w$i>2#H#>Fc|_Qh z^$Vg|uu6y;F)Q)4&`b6oBW$sbY4hW1i<6cC#7@YRVoj;;1hOW_dS{Ze%gCRTQO?P0 zWC0DOPI5U zsW~oLw6^XIsan`<>ynio16ff0_sBq)>sz3jP1&!{CS&XIJM!nhN%CW}eNvC;0#Epr I_*Z2A2KzE2Bme*a literal 0 HcmV?d00001 diff --git a/dotnet/Corelatus/Corelatus.GTH/resource.h b/dotnet/Corelatus/Corelatus.GTH/resource.h new file mode 100644 index 0000000..d5ac7c4 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH/resource.h @@ -0,0 +1,3 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc diff --git a/dotnet/Corelatus/Corelatus.sln b/dotnet/Corelatus/Corelatus.sln new file mode 100644 index 0000000..a16bc15 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Corelatus.GTH", "Corelatus.GTH\Corelatus.GTH.vcxproj", "{6836D52D-2F3E-4568-BB02-9F2D8296CF89}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaveToPcap", "SaveToPcap\SaveToPcap.csproj", "{10900870-540B-45DD-8420-D33C78AE03A5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|Win32.ActiveCfg = Debug|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|Win32.Build.0 = Debug|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|x64.ActiveCfg = Debug|x64 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Debug|x64.Build.0 = Debug|x64 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|Any CPU.ActiveCfg = Release|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|Mixed Platforms.Build.0 = Release|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|Win32.ActiveCfg = Release|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|Win32.Build.0 = Release|Win32 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|x64.ActiveCfg = Release|x64 + {6836D52D-2F3E-4568-BB02-9F2D8296CF89}.Release|x64.Build.0 = Release|x64 + {10900870-540B-45DD-8420-D33C78AE03A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Debug|Win32.ActiveCfg = Debug|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Debug|x64.ActiveCfg = Debug|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Any CPU.Build.0 = Release|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Win32.ActiveCfg = Release|Any CPU + {10900870-540B-45DD-8420-D33C78AE03A5}.Release|x64.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/dotnet/Corelatus/SaveToPcap/App.config b/dotnet/Corelatus/SaveToPcap/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/dotnet/Corelatus/SaveToPcap/Channel.cs b/dotnet/Corelatus/SaveToPcap/Channel.cs new file mode 100644 index 0000000..a2b10ba --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Channel.cs @@ -0,0 +1,8 @@ +namespace SaveToPcap +{ + public class Channel + { + public string Span { get; set; } + public int[] Timeslots { get; set; } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Cmd.cs b/dotnet/Corelatus/SaveToPcap/Cmd.cs new file mode 100644 index 0000000..1e1522c --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Cmd.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using CLAP; +using PcapngUtils.Common; +using PcapngUtils.Pcap; + +namespace SaveToPcap +{ + class Cmd + { + private PcapWriter _writer; + + [Verb(IsDefault=true)] + public void Test( + [Required]string ip, + [DefaultValue(false)]bool fisu, + [DefaultValue(false)] bool esnf, + [DefaultValue(true)][Aliases("m")]bool monitor, + [DefaultValue(false)][Aliases("v")]bool verbose, + [Required][Aliases("s")]string spans, + [Required][Aliases("t")]string timeslots, + [Required][Aliases("o")]string output) + { + Console.WriteLine("Output file is '{0}'",output); + var header = SectionHeader.CreateEmptyHeader(); + header.LinkType=LinkTypes.Mtp2; + _writer = new PcapWriter(output, header); + + var parsedTs = timeslots.Split(' '); + var tsArr = new int[parsedTs.Length]; + Console.Write("Timeslots are: "); + for (var i = 0; i < parsedTs.Length; i++) + { + tsArr[i] = int.Parse(parsedTs[i]); + Console.Write("{0},",tsArr[i]); + } + Console.WriteLine(); + + var parsedSpans = spans.Split(' '); + + Console.WriteLine("Defining channels..."); + var channels = new List(); + for(var j=0;j Channels { get; set; } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/EndianReader.cs b/dotnet/Corelatus/SaveToPcap/EndianReader.cs new file mode 100644 index 0000000..abe7603 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/EndianReader.cs @@ -0,0 +1,48 @@ +using System; + +namespace SaveToPcap +{ + public static class EndianReader + { + public unsafe static UInt16 ReadUInt16Big(byte[] data, int offset) + { + UInt16 value; + byte* ptr = (byte*)&value; + + *(ptr) = data[offset + 1]; + *(ptr + 1) = data[offset]; + + return value; + } + + public unsafe static UInt32 ReadUInt32Big(byte[] data, int offset) + { + UInt32 value; + byte* ptr = (byte*)&value; + + *ptr = data[offset + 3]; + *(ptr + 1) = data[offset + 2]; + *(ptr + 2) = data[offset + 1]; + *(ptr + 3) = data[offset]; + + return value; + } + + public unsafe static UInt64 ReadUInt64Big(byte[] data, int offset) + { + UInt64 value; + byte* ptr = (byte*)&value; + + *ptr = data[offset + 7]; + *(ptr + 1) = data[offset + 6]; + *(ptr + 2) = data[offset + 5]; + *(ptr + 3) = data[offset + 4]; + *(ptr + 4) = data[offset + 3]; + *(ptr + 5) = data[offset + 2]; + *(ptr + 6) = data[offset + 1]; + *(ptr + 7) = data[offset]; + + return value; + } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Extensions.cs b/dotnet/Corelatus/SaveToPcap/Extensions.cs new file mode 100644 index 0000000..772e022 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Extensions.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using Corelatus.GTH; + +namespace SaveToPcap +{ + public static class Extensions + { + public static bool EnableElectricalL1(this Device device,string span, bool monitoring) + { + var atts = new List + { + new DeviceAttribute("status", "enabled"), + new DeviceAttribute("tx_enabled", "false"), + }; + if (monitoring) + atts.Add(new DeviceAttribute("monitoring", "true")); + + span = "pcm" + span; + + return device.Set(span, atts); + } + + public static bool EnableOpticalL1(this Device device,string span) + { + return device.Enable(span, null); + } + + public static bool EnableL1(this Device device,IEnumerable channels, bool monitoring) + { + var value = device.QueryResourceAttribute("board", "architecture"); + var succeed = true; + if (value.StartsWith("gth")) + { + foreach (var c in channels) + succeed &= EnableElectricalL1(device, c.Span, monitoring); + } + else + { + foreach (var c in channels) + succeed &= EnableOpticalL1(device, c.Span); + } + return succeed; + } + + public static bool MonitorMtp2(this Device device, Mtp2Config config, ref string jobId) + { + var atts = new List(); + + if (config.DropFisus) + atts.Add(new DeviceAttribute("fisu", "no")); + + if (config.Esnf) + atts.Add(new DeviceAttribute("esnf", "yes")); + + var res = device.NewMtp2Monitor(config.Tag, config.Channel.Span, config.Channel.Timeslots, config.Listener, + atts, ref jobId); + + return res; + } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Config.cs b/dotnet/Corelatus/SaveToPcap/Mtp2Config.cs new file mode 100644 index 0000000..76bc538 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Mtp2Config.cs @@ -0,0 +1,13 @@ +using Corelatus.GTH; + +namespace SaveToPcap +{ + public class Mtp2Config + { + public Channel Channel { get; set; } + public Listener Listener { get; set; } + public bool DropFisus { get; set; } + public bool Esnf { get; set; } + public int Tag { get; set; } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs b/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs new file mode 100644 index 0000000..4530b05 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs @@ -0,0 +1,57 @@ +using System; +using System.Linq; + +namespace SaveToPcap +{ + public class Mtp2Packet : EventArgs + { + private readonly byte[] _header; + private readonly byte[] _payload; + + private readonly Lazy _tag; + private readonly Lazy _flags; + private readonly Lazy _tsHigh; + private readonly Lazy _tsLow; + + public ushort Tag + { + get { return _tag.Value; } + } + + public ushort Flags + { + get { return _flags.Value; } + } + + public ushort TimestampHigh + { + get { return _tsHigh.Value; } + } + + public uint TimestampLow + { + get { return _tsLow.Value; } + } + + public byte[] Payload + { + get { return _payload; } + } + + public Mtp2Packet(byte[] header, byte[] payload) + { + _header = header; + _payload = payload; + + _tag = new Lazy(() => EndianReader.ReadUInt16Big(_header, 0)); + _flags = new Lazy(() => EndianReader.ReadUInt16Big(_header, 2)); + _tsHigh = new Lazy(() => EndianReader.ReadUInt16Big(_header, 4)); + _tsLow = new Lazy(() => EndianReader.ReadUInt32Big(_header, 6)); + } + + public Mtp2Packet(byte[] data) + : this(data.Take(10).ToArray(), data.Skip(10).ToArray()) + { + } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs b/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs new file mode 100644 index 0000000..b07f04d --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Corelatus; +using Corelatus.GTH; + +namespace SaveToPcap +{ + internal class Mtp2Receiver + { + public event EventHandler PacketReceived; + + private readonly Config _config; + private Device _device; + private Listener _listener; + private DataConnection _dataConn; + + private readonly List _jobIds = new List(); + + public IEnumerable GetJobIds() + { + return _jobIds.ToArray(); + } + + public Mtp2Receiver(Config config) + { + _config = config; + } + + public void Start() + { + Connect(); + EnableL1(); + OpenListener(); + MonitorMtp2(); + EstablishData(); + + Task.Factory.StartNew(Fetch, TaskCreationOptions.LongRunning); + } + + private void OnPacketReceived(Mtp2Packet packet) + { + if (PacketReceived != null) + PacketReceived(this, packet); + } + + private void Fetch() + { + var reader = _dataConn.GetReader(); + var lenBuffer = new byte[2]; + + while (true) + { + if (_device.WaitForPacket(_dataConn)) + { + reader.ReadExact(lenBuffer,0,lenBuffer.Length); + var len = EndianReader.ReadUInt16Big(lenBuffer,0); + var header = new byte[10]; + reader.ReadExact(header,0,header.Length); + var payload = new byte[len - header.Length]; + reader.ReadExact(payload,0,payload.Length); + + var mtp2 = new Mtp2Packet(header, payload); + OnPacketReceived(mtp2); + } + } + } + + private void EstablishData() + { + _dataConn = _device.WaitForAccept(_listener) as DataConnection; + if (_dataConn == null) + throw new CorelatusException(string.Format("failed to open data connection for device '{0}'.", _config.Address)); + } + + private void MonitorMtp2() + { + var tag = 0; + foreach (var c in _config.Channels) + { + var mtp2Config = new Mtp2Config + { + Channel = c, + DropFisus = !_config.Fisu, + Esnf = _config.Esnf, + Listener = _listener, + Tag = tag + }; + tag++; + + string jobId=null; + if (!_device.MonitorMtp2(mtp2Config, ref jobId)) + throw new CorelatusException(string.Format("failed to channel {0} for device '{1}'.", tag - 1, + _config.Address)); + _jobIds.Add(jobId); + } + } + + private void Connect() + { + _device = Device.Connect(_config.Address,_config.Verbose); + if (_device == null) + throw new CorelatusException(string.Format("failed to open device '{0}'.", _config.Address)); + } + + private void OpenListener() + { + _listener = _device.Listen() as Listener; + if (_listener == null) + throw new CorelatusException(string.Format("failed to open listener for device '{0}'.", _config.Address)); + } + + private void EnableL1() + { + if (!_device.EnableL1(_config.Channels, _config.Monitoring)) + throw new CorelatusException(string.Format("failed to enable L1 for device '{0}'.", _config.Address)); + } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Program.cs b/dotnet/Corelatus/SaveToPcap/Program.cs new file mode 100644 index 0000000..8154f03 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Program.cs @@ -0,0 +1,12 @@ +using CLAP; + +namespace SaveToPcap +{ + class Program + { + private static void Main(string[] args) + { + Parser.RunConsole(args, new Cmd()); + } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Properties/AssemblyInfo.cs b/dotnet/Corelatus/SaveToPcap/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b69bb9f --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SaveToPcap")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SaveToPcap")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("923c3dd7-5578-450f-883e-59d8e47e3f59")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj b/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj new file mode 100644 index 0000000..4b4672f --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {10900870-540B-45DD-8420-D33C78AE03A5} + Exe + Properties + SaveToPcap + SaveToPcap + v4.5 + 512 + + + x64 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + true + + + x64 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + true + + + + ..\packages\CLAP.4.6\lib\net35\CLAP.dll + True + + + ..\..\..\..\Gears\Gears\Gemik.Gears\3rdParty\PcapngUtils\PcapngUtils.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + {6836d52d-2f3e-4568-bb02-9f2d8296cf89} + Corelatus.GTH + + + + + \ No newline at end of file diff --git a/dotnet/Corelatus/SaveToPcap/packages.config b/dotnet/Corelatus/SaveToPcap/packages.config new file mode 100644 index 0000000..723ecf4 --- /dev/null +++ b/dotnet/Corelatus/SaveToPcap/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From c6400a2f15a91ee1c72ef48938a3af73887fe117 Mon Sep 17 00:00:00 2001 From: Hessam Jalali Date: Wed, 5 Oct 2016 17:08:37 +0330 Subject: [PATCH 16/20] fixed issue with exact read --- .../Corelatus.GTH/Corelatus.GTH.vcxproj | 5 +- .../Corelatus/Corelatus.GTH/DeviceReader.cpp | 2 +- dotnet/Corelatus/SaveToPcap/Cmd.cs | 66 ++++++++++--------- dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs | 31 +++++---- dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs | 62 +++++++++++++---- 5 files changed, 105 insertions(+), 61 deletions(-) diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj index ae258ea..165ef94 100644 --- a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj @@ -111,11 +111,12 @@ Level3 WIN32;NDEBUG;%(PreprocessorDefinitions) - Use + NotUsing + CompileAsCpp true - + ws2_32.lib;%(AdditionalDependencies) diff --git a/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp b/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp index 22f7f11..f40f7e6 100644 --- a/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp +++ b/dotnet/Corelatus/Corelatus.GTH/DeviceReader.cpp @@ -34,6 +34,6 @@ void DeviceReader::ReadExact(array ^buffer, int offset, int length){ throw gcnew CorelatusException("failed to read from device."); length -= this_time; - offset += this_time; + ptr_buff+=this_time; } } \ No newline at end of file diff --git a/dotnet/Corelatus/SaveToPcap/Cmd.cs b/dotnet/Corelatus/SaveToPcap/Cmd.cs index 1e1522c..16b6b1a 100644 --- a/dotnet/Corelatus/SaveToPcap/Cmd.cs +++ b/dotnet/Corelatus/SaveToPcap/Cmd.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using CLAP; using PcapngUtils.Common; using PcapngUtils.Pcap; @@ -18,7 +19,6 @@ public void Test( [DefaultValue(true)][Aliases("m")]bool monitor, [DefaultValue(false)][Aliases("v")]bool verbose, [Required][Aliases("s")]string spans, - [Required][Aliases("t")]string timeslots, [Required][Aliases("o")]string output) { Console.WriteLine("Output file is '{0}'",output); @@ -26,31 +26,7 @@ public void Test( header.LinkType=LinkTypes.Mtp2; _writer = new PcapWriter(output, header); - var parsedTs = timeslots.Split(' '); - var tsArr = new int[parsedTs.Length]; - Console.Write("Timeslots are: "); - for (var i = 0; i < parsedTs.Length; i++) - { - tsArr[i] = int.Parse(parsedTs[i]); - Console.Write("{0},",tsArr[i]); - } - Console.WriteLine(); - - var parsedSpans = spans.Split(' '); - - Console.WriteLine("Defining channels..."); - var channels = new List(); - for(var j=0;j DefineChannels(string spans) + { + Console.WriteLine("Defining channels..."); + var channels = new List(); + var parsedSpans = spans.Split(','); + + foreach (var span in parsedSpans) + { + var parts = span.Trim().Split(' '); + var ch = parts[0]; + var tsArr = parts.Skip(1).Select(t => int.Parse(t)).ToArray(); - receiver.Start(); - Console.WriteLine("Mtp2 montoring started."); - Console.ReadKey(true); + for (var j = 0; j < tsArr.Length; j++) + { + Console.WriteLine("Channel '{0}:{1}' defined.", ch, tsArr[j]); + var c = new Channel + { + Span = ch, + Timeslots = new[] {tsArr[j]} + }; + channels.Add(c); + } + } + return channels; } private void PacketReceived(object sender, Mtp2Packet e) { - _writer.WriteUnsafe(e.TimestampHigh, e.TimestampLow, e.Payload); + _writer.WriteUnsafe(e.Seconds, e.Microseconds, e.Payload); } } } diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs b/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs index 4530b05..ab97e9c 100644 --- a/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs +++ b/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs @@ -10,8 +10,9 @@ public class Mtp2Packet : EventArgs private readonly Lazy _tag; private readonly Lazy _flags; - private readonly Lazy _tsHigh; - private readonly Lazy _tsLow; + + private readonly uint _secs; + private readonly uint _uSecs; public ushort Tag { @@ -23,21 +24,14 @@ public ushort Flags get { return _flags.Value; } } - public ushort TimestampHigh - { - get { return _tsHigh.Value; } - } - - public uint TimestampLow - { - get { return _tsLow.Value; } - } - public byte[] Payload { get { return _payload; } } + public uint Seconds { get; private set; } + public uint Microseconds { get; private set; } + public Mtp2Packet(byte[] header, byte[] payload) { _header = header; @@ -45,8 +39,17 @@ public Mtp2Packet(byte[] header, byte[] payload) _tag = new Lazy(() => EndianReader.ReadUInt16Big(_header, 0)); _flags = new Lazy(() => EndianReader.ReadUInt16Big(_header, 2)); - _tsHigh = new Lazy(() => EndianReader.ReadUInt16Big(_header, 4)); - _tsLow = new Lazy(() => EndianReader.ReadUInt32Big(_header, 6)); + + + var tsHigh = EndianReader.ReadUInt16Big(_header, 4); + var tsLow =EndianReader.ReadUInt32Big(_header, 6); + + ulong ts = tsHigh; + ts <<= 32; + ts += tsLow; + + Seconds = (uint)(ts / 1000); + Microseconds = (uint)((ts % 1000) * 1000); } public Mtp2Packet(byte[] data) diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs b/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs index b07f04d..2538714 100644 --- a/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs +++ b/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Corelatus; using Corelatus.GTH; namespace SaveToPcap { - internal class Mtp2Receiver + internal class Mtp2Receiver:IDisposable { public event EventHandler PacketReceived; @@ -14,7 +15,9 @@ internal class Mtp2Receiver private Device _device; private Listener _listener; private DataConnection _dataConn; - + private bool _started; + private readonly ManualResetEventSlim _waitHandle = new ManualResetEventSlim(); + private readonly List _jobIds = new List(); public IEnumerable GetJobIds() @@ -35,12 +38,13 @@ public void Start() MonitorMtp2(); EstablishData(); + _started = true; Task.Factory.StartNew(Fetch, TaskCreationOptions.LongRunning); } private void OnPacketReceived(Mtp2Packet packet) { - if (PacketReceived != null) + if (_started && PacketReceived != null) PacketReceived(this, packet); } @@ -49,21 +53,43 @@ private void Fetch() var reader = _dataConn.GetReader(); var lenBuffer = new byte[2]; - while (true) + while (_started) { - if (_device.WaitForPacket(_dataConn)) + ushort len=0; + + try + { + if (_device.WaitForPacket(_dataConn)) + { + reader.ReadExact(lenBuffer, 0, lenBuffer.Length); + len = EndianReader.ReadUInt16Big(lenBuffer, 0); + var header = new byte[10]; + reader.ReadExact(header, 0, header.Length); + var payload = new byte[len - header.Length]; + reader.ReadExact(payload, 0, payload.Length); + + var mtp2 = new Mtp2Packet(header, payload); + OnPacketReceived(mtp2); + } + } + catch (Exception e) { - reader.ReadExact(lenBuffer,0,lenBuffer.Length); - var len = EndianReader.ReadUInt16Big(lenBuffer,0); - var header = new byte[10]; - reader.ReadExact(header,0,header.Length); - var payload = new byte[len - header.Length]; - reader.ReadExact(payload,0,payload.Length); - - var mtp2 = new Mtp2Packet(header, payload); - OnPacketReceived(mtp2); + Console.WriteLine("len: {0}",len); + Console.WriteLine(e); } } + + _waitHandle.Set(); + } + + private void CleanResources() + { + foreach (var j in _jobIds) + _device.Delete(j); + + _dataConn.Dispose(); + _listener.Dispose(); + _device.Dispose(); } private void EstablishData() @@ -115,5 +141,13 @@ private void EnableL1() if (!_device.EnableL1(_config.Channels, _config.Monitoring)) throw new CorelatusException(string.Format("failed to enable L1 for device '{0}'.", _config.Address)); } + + public void Dispose() + { + PacketReceived = null; + _started = false; + _waitHandle.Wait(10000); + CleanResources(); + } } } From ca20732f118c2f0f956fb95ae2771f347298dd6f Mon Sep 17 00:00:00 2001 From: Hessam Jalali Date: Wed, 5 Oct 2016 17:30:10 +0330 Subject: [PATCH 17/20] gitignore updated --- .gitignore | 271 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 265 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5e024fc..1b86e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,268 @@ -CVS -*.pyc -*.beam -*~ -.cvsignore -*.zip +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files *.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta *.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf *.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/ From 98431b7d040473b2e309a772e78643424ff1f6a8 Mon Sep 17 00:00:00 2001 From: Hessam Jalali Date: Wed, 5 Oct 2016 17:39:46 +0330 Subject: [PATCH 18/20] removed auto generated readme --- dotnet/Corelatus/Corelatus.GTH/ReadMe.txt | 37 ++--------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt b/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt index 9265694..e7879eb 100644 --- a/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt +++ b/dotnet/Corelatus/Corelatus.GTH/ReadMe.txt @@ -1,38 +1,5 @@ ======================================================================== - DYNAMIC LINK LIBRARY : Corelatus.GTH Project Overview + Corelatus.GTH CLI Wrapper ======================================================================== -AppWizard has created this Corelatus.GTH DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your Corelatus.GTH application. - -Corelatus.GTH.vcxproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -Corelatus.GTH.vcxproj.filters - This is the filters file for VC++ projects generated using an Application Wizard. - It contains information about the association between the files in your project - and the filters. This association is used in the IDE to show grouping of files with - similar extensions under a specific node (for e.g. ".cpp" files are associated with the - "Source Files" filter). - -Corelatus.GTH.cpp - This is the main DLL source file. - -Corelatus.GTH.h - This file contains a class declaration. - -AssemblyInfo.cpp - Contains custom attributes for modifying assembly metadata. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// +A C++/CLI wrapper based on official C version. \ No newline at end of file From 430e8f9e26ba972eebe9fc21f5d40906b6d4db28 Mon Sep 17 00:00:00 2001 From: Hessam Jalali Date: Wed, 5 Oct 2016 18:31:44 +0330 Subject: [PATCH 19/20] utilities added --- .../Channel.cs | 2 +- .../Config.cs | 2 +- .../Corelatus.GTH.Utilities.csproj | 68 +++++++++++++++++++ .../EndianReader.cs | 2 +- .../Extensions.cs | 3 +- .../Mtp2Config.cs | 4 +- .../Corelatus.GTH.Utilities/Mtp2FailedArgs.cs | 14 ++++ .../Mtp2Packet.cs | 5 +- .../Mtp2Receiver.cs | 22 +++--- .../Properties/AssemblyInfo.cs | 36 ++++++++++ dotnet/Corelatus/Corelatus.sln | 14 ++++ dotnet/Corelatus/SaveToPcap/Cmd.cs | 3 + dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj | 13 +--- 13 files changed, 156 insertions(+), 32 deletions(-) rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/Channel.cs (77%) rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/Config.cs (91%) create mode 100644 dotnet/Corelatus/Corelatus.GTH.Utilities/Corelatus.GTH.Utilities.csproj rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/EndianReader.cs (97%) rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/Extensions.cs (97%) rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/Mtp2Config.cs (84%) create mode 100644 dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2FailedArgs.cs rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/Mtp2Packet.cs (93%) rename dotnet/Corelatus/{SaveToPcap => Corelatus.GTH.Utilities}/Mtp2Receiver.cs (91%) create mode 100644 dotnet/Corelatus/Corelatus.GTH.Utilities/Properties/AssemblyInfo.cs diff --git a/dotnet/Corelatus/SaveToPcap/Channel.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Channel.cs similarity index 77% rename from dotnet/Corelatus/SaveToPcap/Channel.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/Channel.cs index a2b10ba..4569955 100644 --- a/dotnet/Corelatus/SaveToPcap/Channel.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Channel.cs @@ -1,4 +1,4 @@ -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { public class Channel { diff --git a/dotnet/Corelatus/SaveToPcap/Config.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Config.cs similarity index 91% rename from dotnet/Corelatus/SaveToPcap/Config.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/Config.cs index 25509f2..8a5cfd1 100644 --- a/dotnet/Corelatus/SaveToPcap/Config.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Config.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { public class Config { diff --git a/dotnet/Corelatus/Corelatus.GTH.Utilities/Corelatus.GTH.Utilities.csproj b/dotnet/Corelatus/Corelatus.GTH.Utilities/Corelatus.GTH.Utilities.csproj new file mode 100644 index 0000000..3bb7843 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Corelatus.GTH.Utilities.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3} + Library + Properties + Corelatus.GTH.Utilities + Corelatus.GTH.Utilities + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + x64 + true + + + + + + + + + + + + + + + + + + + + + + + + {6836d52d-2f3e-4568-bb02-9f2d8296cf89} + Corelatus.GTH + + + + + \ No newline at end of file diff --git a/dotnet/Corelatus/SaveToPcap/EndianReader.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/EndianReader.cs similarity index 97% rename from dotnet/Corelatus/SaveToPcap/EndianReader.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/EndianReader.cs index abe7603..59c6e6f 100644 --- a/dotnet/Corelatus/SaveToPcap/EndianReader.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/EndianReader.cs @@ -1,6 +1,6 @@ using System; -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { public static class EndianReader { diff --git a/dotnet/Corelatus/SaveToPcap/Extensions.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Extensions.cs similarity index 97% rename from dotnet/Corelatus/SaveToPcap/Extensions.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/Extensions.cs index 772e022..561eaa1 100644 --- a/dotnet/Corelatus/SaveToPcap/Extensions.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Extensions.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; -using Corelatus.GTH; -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { public static class Extensions { diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Config.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Config.cs similarity index 84% rename from dotnet/Corelatus/SaveToPcap/Mtp2Config.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Config.cs index 76bc538..6e2b09e 100644 --- a/dotnet/Corelatus/SaveToPcap/Mtp2Config.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Config.cs @@ -1,6 +1,4 @@ -using Corelatus.GTH; - -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { public class Mtp2Config { diff --git a/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2FailedArgs.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2FailedArgs.cs new file mode 100644 index 0000000..f0318a2 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2FailedArgs.cs @@ -0,0 +1,14 @@ +using System; + +namespace Corelatus.GTH.Utilities +{ + public class Mtp2FailedArgs:EventArgs + { + public Exception Exception { get;private set; } + + internal Mtp2FailedArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Packet.cs similarity index 93% rename from dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Packet.cs index ab97e9c..6ab1b48 100644 --- a/dotnet/Corelatus/SaveToPcap/Mtp2Packet.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Packet.cs @@ -1,7 +1,7 @@ using System; using System.Linq; -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { public class Mtp2Packet : EventArgs { @@ -11,9 +11,6 @@ public class Mtp2Packet : EventArgs private readonly Lazy _tag; private readonly Lazy _flags; - private readonly uint _secs; - private readonly uint _uSecs; - public ushort Tag { get { return _tag.Value; } diff --git a/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Receiver.cs similarity index 91% rename from dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs rename to dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Receiver.cs index 2538714..d3df9e0 100644 --- a/dotnet/Corelatus/SaveToPcap/Mtp2Receiver.cs +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Mtp2Receiver.cs @@ -2,15 +2,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Corelatus; -using Corelatus.GTH; -namespace SaveToPcap +namespace Corelatus.GTH.Utilities { - internal class Mtp2Receiver:IDisposable + public class Mtp2Receiver:IDisposable { public event EventHandler PacketReceived; - + public event EventHandler Failed; + private readonly Config _config; private Device _device; private Listener _listener; @@ -48,6 +47,12 @@ private void OnPacketReceived(Mtp2Packet packet) PacketReceived(this, packet); } + private void OnFailed(Exception exception) + { + if (Failed != null) + Failed(this, new Mtp2FailedArgs(exception)); + } + private void Fetch() { var reader = _dataConn.GetReader(); @@ -55,14 +60,12 @@ private void Fetch() while (_started) { - ushort len=0; - try { if (_device.WaitForPacket(_dataConn)) { reader.ReadExact(lenBuffer, 0, lenBuffer.Length); - len = EndianReader.ReadUInt16Big(lenBuffer, 0); + var len=EndianReader.ReadUInt16Big(lenBuffer, 0); var header = new byte[10]; reader.ReadExact(header, 0, header.Length); var payload = new byte[len - header.Length]; @@ -74,8 +77,7 @@ private void Fetch() } catch (Exception e) { - Console.WriteLine("len: {0}",len); - Console.WriteLine(e); + OnFailed(e); } } diff --git a/dotnet/Corelatus/Corelatus.GTH.Utilities/Properties/AssemblyInfo.cs b/dotnet/Corelatus/Corelatus.GTH.Utilities/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8700549 --- /dev/null +++ b/dotnet/Corelatus/Corelatus.GTH.Utilities/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Corelatus.GTH.Utilities")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Corelatus.GTH.Utilities")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("08eea402-5d24-4ebc-98a7-fe94c4fc4fb9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/dotnet/Corelatus/Corelatus.sln b/dotnet/Corelatus/Corelatus.sln index a16bc15..c9433d0 100644 --- a/dotnet/Corelatus/Corelatus.sln +++ b/dotnet/Corelatus/Corelatus.sln @@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Corelatus.GTH", "Corelatus. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaveToPcap", "SaveToPcap\SaveToPcap.csproj", "{10900870-540B-45DD-8420-D33C78AE03A5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corelatus.GTH.Utilities", "Corelatus.GTH.Utilities\Corelatus.GTH.Utilities.csproj", "{C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,18 @@ Global {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Mixed Platforms.Build.0 = Release|Any CPU {10900870-540B-45DD-8420-D33C78AE03A5}.Release|Win32.ActiveCfg = Release|Any CPU {10900870-540B-45DD-8420-D33C78AE03A5}.Release|x64.ActiveCfg = Release|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Debug|Win32.ActiveCfg = Debug|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Release|Any CPU.Build.0 = Release|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Release|Win32.ActiveCfg = Release|Any CPU + {C50ECF56-6C6A-4CE7-AE01-D59936D4E7F3}.Release|x64.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/dotnet/Corelatus/SaveToPcap/Cmd.cs b/dotnet/Corelatus/SaveToPcap/Cmd.cs index 16b6b1a..3b63207 100644 --- a/dotnet/Corelatus/SaveToPcap/Cmd.cs +++ b/dotnet/Corelatus/SaveToPcap/Cmd.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using CLAP; +using Corelatus.GTH.Utilities; using PcapngUtils.Common; using PcapngUtils.Pcap; @@ -39,6 +41,7 @@ public void Test( Channels = channels }); + receiver.Failed += (s, e) => Console.WriteLine(e); receiver.PacketReceived+=PacketReceived; using (receiver) { diff --git a/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj b/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj index 4b4672f..86502dc 100644 --- a/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj +++ b/dotnet/Corelatus/SaveToPcap/SaveToPcap.csproj @@ -52,14 +52,7 @@ - - - - - - - @@ -68,9 +61,9 @@ - - {6836d52d-2f3e-4568-bb02-9f2d8296cf89} - Corelatus.GTH + + {c50ecf56-6c6a-4ce7-ae01-d59936d4e7f3} + Corelatus.GTH.Utilities From 3a68bbacae560c3a332481daeb6fb221e8f04cb4 Mon Sep 17 00:00:00 2001 From: Hessam Jalali Date: Sun, 9 Oct 2016 16:40:16 +0330 Subject: [PATCH 20/20] renamed to nativeutilities --- dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj | 4 ++-- dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters | 4 ++-- .../Corelatus.GTH/{Utilities.cpp => NativeUtilities.cpp} | 4 ++-- .../Corelatus.GTH/{Utilities.h => NativeUtilities.h} | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename dotnet/Corelatus/Corelatus.GTH/{Utilities.cpp => NativeUtilities.cpp} (74%) rename dotnet/Corelatus/Corelatus.GTH/{Utilities.h => NativeUtilities.h} (85%) diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj index 165ef94..9ef18cf 100644 --- a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj @@ -155,7 +155,7 @@ - + @@ -177,7 +177,7 @@ - + diff --git a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters index e80c095..5243034 100644 --- a/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters +++ b/dotnet/Corelatus/Corelatus.GTH/Corelatus.GTH.vcxproj.filters @@ -66,7 +66,7 @@ Header Files - + Header Files @@ -113,7 +113,7 @@ Source Files - + Source Files diff --git a/dotnet/Corelatus/Corelatus.GTH/Utilities.cpp b/dotnet/Corelatus/Corelatus.GTH/NativeUtilities.cpp similarity index 74% rename from dotnet/Corelatus/Corelatus.GTH/Utilities.cpp rename to dotnet/Corelatus/Corelatus.GTH/NativeUtilities.cpp index c70c6cf..a217a8d 100644 --- a/dotnet/Corelatus/Corelatus.GTH/Utilities.cpp +++ b/dotnet/Corelatus/Corelatus.GTH/NativeUtilities.cpp @@ -1,11 +1,11 @@ #include "stdafx.h" -#include "Utilities.h" +#include "NativeUtilities.h" #include "Socket.h" #include "CorelatusException.h" using namespace Corelatus::GTH; -bool Utilities::WaitForPacket(Device^ device, IConnection^ connection){ +bool NativeUtilities::WaitForPacket(Device^ device, IConnection^ connection){ int res = wait_for_packet(device->NativeApi(), connection->NativeHandle()); if (res == -1) throw gcnew CorelatusException("waiting on packet failed, connection closed abruptly."); diff --git a/dotnet/Corelatus/Corelatus.GTH/Utilities.h b/dotnet/Corelatus/Corelatus.GTH/NativeUtilities.h similarity index 85% rename from dotnet/Corelatus/Corelatus.GTH/Utilities.h rename to dotnet/Corelatus/Corelatus.GTH/NativeUtilities.h index 9287cb4..709fe41 100644 --- a/dotnet/Corelatus/Corelatus.GTH/Utilities.h +++ b/dotnet/Corelatus/Corelatus.GTH/NativeUtilities.h @@ -8,7 +8,7 @@ using namespace System::Runtime::CompilerServices; namespace Corelatus{ namespace GTH{ [ExtensionAttribute] - public ref class Utilities abstract sealed + public ref class NativeUtilities abstract sealed { public: [ExtensionAttribute]