From: Mikko Rasa Date: Sun, 27 Jan 2008 19:35:03 +0000 (+0000) Subject: Initial revision X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=229e1d6ab66a9e987ffe3cd4a8de7c7f874f6de1;p=netvis.git Initial revision --- diff --git a/Build b/Build new file mode 100644 index 0000000..bb1b9a1 --- /dev/null +++ b/Build @@ -0,0 +1,16 @@ +package "netvis" +{ + require "mspcore"; + require "mspgbase"; + require "mspgl"; + + build_info + { + library "pcap"; + }; + + program "netvis" + { + source "source"; + }; +}; diff --git a/dejavu-10.font b/dejavu-10.font new file mode 100644 index 0000000..e2f7dba --- /dev/null +++ b/dejavu-10.font @@ -0,0 +1,1341 @@ +//texture "dejavu-10.png"; +default_size 10; +ascent 1.000; +descent -0.300; +glyph 32 +{ + texcoords 0.035156 0.960938 0.035156 0.960938; + size 0.000 0.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 33 +{ + texcoords 0.101562 0.960938 0.105469 0.988281; + size 0.100 0.700; + offset 0.200 0.000; + advance 0.400; +}; +glyph 34 +{ + texcoords 0.167969 0.976562 0.179688 0.988281; + size 0.300 0.300; + offset 0.100 0.400; + advance 0.500; +}; +glyph 35 +{ + texcoords 0.230469 0.960938 0.257812 0.988281; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 36 +{ + texcoords 0.304688 0.957031 0.328125 0.988281; + size 0.600 0.800; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 37 +{ + texcoords 0.371094 0.960938 0.402344 0.988281; + size 0.800 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 38 +{ + texcoords 0.441406 0.960938 0.468750 0.988281; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.900; +}; +glyph 39 +{ + texcoords 0.523438 0.976562 0.527344 0.988281; + size 0.100 0.300; + offset 0.100 0.400; + advance 0.300; +}; +glyph 40 +{ + texcoords 0.593750 0.957031 0.601562 0.992188; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 41 +{ + texcoords 0.664062 0.957031 0.671875 0.992188; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 42 +{ + texcoords 0.726562 0.972656 0.746094 0.988281; + size 0.500 0.400; + offset 0.000 0.300; + advance 0.500; +}; +glyph 43 +{ + texcoords 0.792969 0.960938 0.820312 0.988281; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 44 +{ + texcoords 0.875000 0.957031 0.878906 0.964844; + size 0.100 0.200; + offset 0.100 -0.100; + advance 0.300; +}; +glyph 45 +{ + texcoords 0.941406 0.968750 0.953125 0.972656; + size 0.300 0.100; + offset 0.100 0.200; + advance 0.400; +}; +glyph 46 +{ + texcoords 0.031250 0.890625 0.035156 0.894531; + size 0.100 0.100; + offset 0.100 0.000; + advance 0.300; +}; +glyph 47 +{ + texcoords 0.097656 0.886719 0.109375 0.917969; + size 0.300 0.800; + offset 0.000 -0.100; + advance 0.300; +}; +glyph 48 +{ + texcoords 0.164062 0.890625 0.183594 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 49 +{ + texcoords 0.234375 0.890625 0.253906 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 50 +{ + texcoords 0.304688 0.890625 0.328125 0.917969; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 51 +{ + texcoords 0.375000 0.890625 0.394531 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 52 +{ + texcoords 0.445312 0.890625 0.464844 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 53 +{ + texcoords 0.515625 0.890625 0.535156 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 54 +{ + texcoords 0.585938 0.890625 0.605469 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 55 +{ + texcoords 0.656250 0.890625 0.675781 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 56 +{ + texcoords 0.726562 0.890625 0.746094 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 57 +{ + texcoords 0.796875 0.890625 0.816406 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 58 +{ + texcoords 0.875000 0.890625 0.878906 0.910156; + size 0.100 0.500; + offset 0.100 0.000; + advance 0.300; +}; +glyph 59 +{ + texcoords 0.945312 0.886719 0.949219 0.910156; + size 0.100 0.600; + offset 0.100 -0.100; + advance 0.300; +}; +glyph 60 +{ + texcoords 0.023438 0.824219 0.046875 0.843750; + size 0.600 0.500; + offset 0.100 0.100; + advance 0.800; +}; +glyph 61 +{ + texcoords 0.093750 0.828125 0.117188 0.839844; + size 0.600 0.300; + offset 0.100 0.200; + advance 0.800; +}; +glyph 62 +{ + texcoords 0.164062 0.824219 0.187500 0.843750; + size 0.600 0.500; + offset 0.100 0.100; + advance 0.800; +}; +glyph 63 +{ + texcoords 0.238281 0.820312 0.253906 0.847656; + size 0.400 0.700; + offset 0.100 0.000; + advance 0.500; +}; +glyph 64 +{ + texcoords 0.296875 0.812500 0.332031 0.847656; + size 0.900 0.900; + offset 0.100 -0.200; + advance 1.100; +}; +glyph 65 +{ + texcoords 0.371094 0.820312 0.398438 0.847656; + size 0.700 0.700; + offset 0.000 0.000; + advance 0.700; +}; +glyph 66 +{ + texcoords 0.445312 0.820312 0.464844 0.847656; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 67 +{ + texcoords 0.515625 0.820312 0.539062 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 68 +{ + texcoords 0.585938 0.820312 0.609375 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 69 +{ + texcoords 0.656250 0.820312 0.675781 0.847656; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 70 +{ + texcoords 0.730469 0.820312 0.746094 0.847656; + size 0.400 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 71 +{ + texcoords 0.796875 0.820312 0.820312 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 72 +{ + texcoords 0.867188 0.820312 0.890625 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 73 +{ + texcoords 0.945312 0.820312 0.949219 0.847656; + size 0.100 0.700; + offset 0.100 0.000; + advance 0.300; +}; +glyph 74 +{ + texcoords 0.027344 0.742188 0.039062 0.777344; + size 0.300 0.900; + offset -0.100 -0.200; + advance 0.300; +}; +glyph 75 +{ + texcoords 0.093750 0.750000 0.117188 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 76 +{ + texcoords 0.164062 0.750000 0.183594 0.777344; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 77 +{ + texcoords 0.230469 0.750000 0.257812 0.777344; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.900; +}; +glyph 78 +{ + texcoords 0.304688 0.750000 0.328125 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 79 +{ + texcoords 0.375000 0.750000 0.398438 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 80 +{ + texcoords 0.445312 0.750000 0.464844 0.777344; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 81 +{ + texcoords 0.515625 0.746094 0.539062 0.777344; + size 0.600 0.800; + offset 0.100 -0.100; + advance 0.800; +}; +glyph 82 +{ + texcoords 0.585938 0.750000 0.609375 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 83 +{ + texcoords 0.656250 0.750000 0.679688 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 84 +{ + texcoords 0.726562 0.750000 0.746094 0.777344; + size 0.500 0.700; + offset 0.000 0.000; + advance 0.500; +}; +glyph 85 +{ + texcoords 0.796875 0.750000 0.820312 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 86 +{ + texcoords 0.859375 0.750000 0.894531 0.777344; + size 0.900 0.700; + offset -0.100 0.000; + advance 0.700; +}; +glyph 87 +{ + texcoords 0.929688 0.750000 0.964844 0.777344; + size 0.900 0.700; + offset 0.000 0.000; + advance 0.900; +}; +glyph 88 +{ + texcoords 0.023438 0.679688 0.046875 0.707031; + size 0.600 0.700; + offset 0.000 0.000; + advance 0.600; +}; +glyph 89 +{ + texcoords 0.089844 0.679688 0.117188 0.707031; + size 0.700 0.700; + offset 0.000 0.000; + advance 0.700; +}; +glyph 90 +{ + texcoords 0.164062 0.679688 0.187500 0.707031; + size 0.600 0.700; + offset 0.000 0.000; + advance 0.600; +}; +glyph 91 +{ + texcoords 0.242188 0.675781 0.250000 0.710938; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 92 +{ + texcoords 0.308594 0.675781 0.320312 0.707031; + size 0.300 0.800; + offset 0.000 -0.100; + advance 0.300; +}; +glyph 93 +{ + texcoords 0.382812 0.675781 0.390625 0.710938; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 94 +{ + texcoords 0.445312 0.695312 0.468750 0.707031; + size 0.600 0.300; + offset 0.100 0.400; + advance 0.800; +}; +glyph 95 +{ + texcoords 0.515625 0.671875 0.535156 0.675781; + size 0.500 0.100; + offset 0.000 -0.200; + advance 0.500; +}; +glyph 96 +{ + texcoords 0.593750 0.703125 0.601562 0.710938; + size 0.200 0.200; + offset 0.100 0.600; + advance 0.500; +}; +glyph 97 +{ + texcoords 0.656250 0.679688 0.675781 0.699219; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 98 +{ + texcoords 0.726562 0.679688 0.746094 0.710938; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 99 +{ + texcoords 0.800781 0.679688 0.816406 0.699219; + size 0.400 0.500; + offset 0.100 0.000; + advance 0.500; +}; +glyph 100 +{ + texcoords 0.867188 0.679688 0.886719 0.710938; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 101 +{ + texcoords 0.937500 0.679688 0.957031 0.699219; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 102 +{ + texcoords 0.027344 0.609375 0.042969 0.640625; + size 0.400 0.800; + offset 0.100 0.000; + advance 0.400; +}; +glyph 103 +{ + texcoords 0.093750 0.601562 0.113281 0.628906; + size 0.500 0.700; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 104 +{ + texcoords 0.164062 0.609375 0.183594 0.640625; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 105 +{ + texcoords 0.242188 0.609375 0.246094 0.640625; + size 0.100 0.800; + offset 0.100 0.000; + advance 0.200; +}; +glyph 106 +{ + texcoords 0.312500 0.601562 0.320312 0.640625; + size 0.200 1.000; + offset 0.000 -0.200; + advance 0.200; +}; +glyph 107 +{ + texcoords 0.375000 0.609375 0.394531 0.640625; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.500; +}; +glyph 108 +{ + texcoords 0.453125 0.609375 0.457031 0.640625; + size 0.100 0.800; + offset 0.100 0.000; + advance 0.200; +}; +glyph 109 +{ + texcoords 0.507812 0.609375 0.542969 0.628906; + size 0.900 0.500; + offset 0.100 0.000; + advance 1.000; +}; +glyph 110 +{ + texcoords 0.585938 0.609375 0.605469 0.628906; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 111 +{ + texcoords 0.656250 0.609375 0.675781 0.628906; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 112 +{ + texcoords 0.726562 0.601562 0.746094 0.628906; + size 0.500 0.700; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 113 +{ + texcoords 0.796875 0.601562 0.816406 0.628906; + size 0.500 0.700; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 114 +{ + texcoords 0.871094 0.609375 0.882812 0.628906; + size 0.300 0.500; + offset 0.100 0.000; + advance 0.400; +}; +glyph 115 +{ + texcoords 0.937500 0.609375 0.957031 0.628906; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.500; +}; +glyph 116 +{ + texcoords 0.027344 0.539062 0.042969 0.566406; + size 0.400 0.700; + offset 0.000 0.000; + advance 0.400; +}; +glyph 117 +{ + texcoords 0.093750 0.539062 0.113281 0.558594; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 118 +{ + texcoords 0.160156 0.539062 0.187500 0.558594; + size 0.700 0.500; + offset 0.000 0.000; + advance 0.600; +}; +glyph 119 +{ + texcoords 0.230469 0.539062 0.257812 0.558594; + size 0.700 0.500; + offset 0.100 0.000; + advance 0.800; +}; +glyph 120 +{ + texcoords 0.304688 0.539062 0.324219 0.558594; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 121 +{ + texcoords 0.371094 0.531250 0.398438 0.558594; + size 0.700 0.700; + offset 0.000 -0.200; + advance 0.600; +}; +glyph 122 +{ + texcoords 0.449219 0.539062 0.464844 0.558594; + size 0.400 0.500; + offset 0.100 0.000; + advance 0.500; +}; +glyph 123 +{ + texcoords 0.519531 0.535156 0.535156 0.570312; + size 0.400 0.900; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 124 +{ + texcoords 0.593750 0.531250 0.597656 0.570312; + size 0.100 1.000; + offset 0.100 -0.200; + advance 0.300; +}; +glyph 125 +{ + texcoords 0.660156 0.535156 0.675781 0.570312; + size 0.400 0.900; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 126 +{ + texcoords 0.726562 0.546875 0.750000 0.558594; + size 0.600 0.300; + offset 0.100 0.200; + advance 0.800; +}; +glyph 160 +{ + texcoords 0.808594 0.539062 0.808594 0.539062; + size 0.000 0.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 161 +{ + texcoords 0.875000 0.539062 0.878906 0.566406; + size 0.100 0.700; + offset 0.200 0.000; + advance 0.400; +}; +glyph 162 +{ + texcoords 0.941406 0.535156 0.957031 0.562500; + size 0.400 0.700; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 163 +{ + texcoords 0.023438 0.468750 0.042969 0.496094; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 164 +{ + texcoords 0.093750 0.468750 0.117188 0.496094; + size 0.600 0.700; + offset 0.000 0.000; + advance 0.600; +}; +glyph 165 +{ + texcoords 0.164062 0.468750 0.183594 0.496094; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 166 +{ + texcoords 0.242188 0.460938 0.246094 0.496094; + size 0.100 0.900; + offset 0.100 -0.200; + advance 0.300; +}; +glyph 167 +{ + texcoords 0.308594 0.464844 0.324219 0.496094; + size 0.400 0.800; + offset 0.000 -0.100; + advance 0.500; +}; +glyph 168 +{ + texcoords 0.378906 0.492188 0.390625 0.496094; + size 0.300 0.100; + offset 0.100 0.600; + advance 0.500; +}; +glyph 169 +{ + texcoords 0.441406 0.468750 0.468750 0.496094; + size 0.700 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 170 +{ + texcoords 0.515625 0.472656 0.535156 0.496094; + size 0.500 0.600; + offset 0.100 0.100; + advance 0.500; +}; +glyph 171 +{ + texcoords 0.589844 0.472656 0.605469 0.488281; + size 0.400 0.400; + offset 0.100 0.100; + advance 0.600; +}; +glyph 172 +{ + texcoords 0.656250 0.472656 0.679688 0.484375; + size 0.600 0.300; + offset 0.100 0.100; + advance 0.800; +}; +glyph 173 +{ + texcoords 0.730469 0.476562 0.742188 0.480469; + size 0.300 0.100; + offset 0.100 0.200; + advance 0.400; +}; +glyph 174 +{ + texcoords 0.792969 0.468750 0.820312 0.496094; + size 0.700 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 175 +{ + texcoords 0.871094 0.492188 0.882812 0.496094; + size 0.300 0.100; + offset 0.100 0.600; + advance 0.500; +}; +glyph 176 +{ + texcoords 0.941406 0.484375 0.953125 0.496094; + size 0.300 0.300; + offset 0.100 0.400; + advance 0.500; +}; +glyph 177 +{ + texcoords 0.019531 0.398438 0.046875 0.421875; + size 0.700 0.600; + offset 0.100 0.000; + advance 0.800; +}; +glyph 178 +{ + texcoords 0.097656 0.410156 0.109375 0.425781; + size 0.300 0.400; + offset 0.100 0.300; + advance 0.400; +}; +glyph 179 +{ + texcoords 0.167969 0.410156 0.179688 0.425781; + size 0.300 0.400; + offset 0.100 0.300; + advance 0.400; +}; +glyph 180 +{ + texcoords 0.242188 0.421875 0.250000 0.429688; + size 0.200 0.200; + offset 0.200 0.600; + advance 0.500; +}; +glyph 181 +{ + texcoords 0.304688 0.390625 0.328125 0.417969; + size 0.600 0.700; + offset 0.100 -0.200; + advance 0.700; +}; +glyph 182 +{ + texcoords 0.375000 0.394531 0.394531 0.425781; + size 0.500 0.800; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 183 +{ + texcoords 0.453125 0.410156 0.457031 0.414062; + size 0.100 0.100; + offset 0.100 0.300; + advance 0.300; +}; +glyph 184 +{ + texcoords 0.523438 0.390625 0.531250 0.398438; + size 0.200 0.200; + offset 0.100 -0.200; + advance 0.500; +}; +glyph 185 +{ + texcoords 0.589844 0.410156 0.601562 0.425781; + size 0.300 0.400; + offset 0.100 0.300; + advance 0.400; +}; +glyph 186 +{ + texcoords 0.660156 0.402344 0.675781 0.425781; + size 0.400 0.600; + offset 0.100 0.100; + advance 0.500; +}; +glyph 187 +{ + texcoords 0.730469 0.402344 0.746094 0.417969; + size 0.400 0.400; + offset 0.100 0.100; + advance 0.600; +}; +glyph 188 +{ + texcoords 0.789062 0.398438 0.824219 0.425781; + size 0.900 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 189 +{ + texcoords 0.859375 0.398438 0.894531 0.425781; + size 0.900 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 190 +{ + texcoords 0.929688 0.398438 0.964844 0.425781; + size 0.900 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 191 +{ + texcoords 0.027344 0.328125 0.042969 0.355469; + size 0.400 0.700; + offset 0.100 0.000; + advance 0.500; +}; +glyph 192 +{ + texcoords 0.089844 0.328125 0.117188 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 193 +{ + texcoords 0.160156 0.328125 0.187500 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 194 +{ + texcoords 0.230469 0.328125 0.257812 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 195 +{ + texcoords 0.300781 0.328125 0.328125 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 196 +{ + texcoords 0.371094 0.328125 0.398438 0.363281; + size 0.700 0.900; + offset 0.000 0.000; + advance 0.700; +}; +glyph 197 +{ + texcoords 0.441406 0.328125 0.468750 0.363281; + size 0.700 0.900; + offset 0.000 0.000; + advance 0.700; +}; +glyph 198 +{ + texcoords 0.507812 0.328125 0.542969 0.355469; + size 0.900 0.700; + offset 0.000 0.000; + advance 1.000; +}; +glyph 199 +{ + texcoords 0.585938 0.320312 0.609375 0.355469; + size 0.600 0.900; + offset 0.100 -0.200; + advance 0.800; +}; +glyph 200 +{ + texcoords 0.656250 0.328125 0.675781 0.367188; + size 0.500 1.000; + offset 0.100 0.000; + advance 0.700; +}; +glyph 201 +{ + texcoords 0.726562 0.328125 0.746094 0.367188; + size 0.500 1.000; + offset 0.100 0.000; + advance 0.700; +}; +glyph 202 +{ + texcoords 0.796875 0.328125 0.816406 0.367188; + size 0.500 1.000; + offset 0.100 0.000; + advance 0.700; +}; +glyph 203 +{ + texcoords 0.867188 0.328125 0.886719 0.363281; + size 0.500 0.900; + offset 0.100 0.000; + advance 0.700; +}; +glyph 204 +{ + texcoords 0.945312 0.328125 0.953125 0.367188; + size 0.200 1.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 205 +{ + texcoords 0.027344 0.257812 0.039062 0.296875; + size 0.300 1.000; + offset 0.100 0.000; + advance 0.300; +}; +glyph 206 +{ + texcoords 0.097656 0.257812 0.109375 0.296875; + size 0.300 1.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 207 +{ + texcoords 0.167969 0.257812 0.179688 0.292969; + size 0.300 0.900; + offset 0.000 0.000; + advance 0.300; +}; +glyph 208 +{ + texcoords 0.230469 0.257812 0.257812 0.285156; + size 0.700 0.700; + offset 0.000 0.000; + advance 0.800; +}; +glyph 209 +{ + texcoords 0.304688 0.257812 0.328125 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 210 +{ + texcoords 0.375000 0.257812 0.398438 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 211 +{ + texcoords 0.445312 0.257812 0.468750 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 212 +{ + texcoords 0.515625 0.257812 0.539062 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 213 +{ + texcoords 0.585938 0.257812 0.609375 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 214 +{ + texcoords 0.656250 0.257812 0.679688 0.292969; + size 0.600 0.900; + offset 0.100 0.000; + advance 0.800; +}; +glyph 215 +{ + texcoords 0.726562 0.257812 0.750000 0.281250; + size 0.600 0.600; + offset 0.100 0.000; + advance 0.800; +}; +glyph 216 +{ + texcoords 0.792969 0.253906 0.824219 0.289062; + size 0.800 0.900; + offset 0.000 -0.100; + advance 0.800; +}; +glyph 217 +{ + texcoords 0.867188 0.257812 0.890625 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 218 +{ + texcoords 0.937500 0.257812 0.960938 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 219 +{ + texcoords 0.023438 0.187500 0.046875 0.226562; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 220 +{ + texcoords 0.093750 0.187500 0.117188 0.222656; + size 0.600 0.900; + offset 0.100 0.000; + advance 0.800; +}; +glyph 221 +{ + texcoords 0.160156 0.187500 0.187500 0.226562; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 222 +{ + texcoords 0.234375 0.187500 0.253906 0.214844; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 223 +{ + texcoords 0.304688 0.187500 0.324219 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 224 +{ + texcoords 0.375000 0.187500 0.394531 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 225 +{ + texcoords 0.445312 0.187500 0.464844 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 226 +{ + texcoords 0.515625 0.187500 0.535156 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 227 +{ + texcoords 0.585938 0.187500 0.605469 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 228 +{ + texcoords 0.656250 0.187500 0.675781 0.214844; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 229 +{ + texcoords 0.726562 0.187500 0.746094 0.222656; + size 0.500 0.900; + offset 0.100 0.000; + advance 0.600; +}; +glyph 230 +{ + texcoords 0.789062 0.187500 0.824219 0.207031; + size 0.900 0.500; + offset 0.100 0.000; + advance 1.000; +}; +glyph 231 +{ + texcoords 0.871094 0.179688 0.886719 0.207031; + size 0.400 0.700; + offset 0.100 -0.200; + advance 0.500; +}; +glyph 232 +{ + texcoords 0.937500 0.187500 0.957031 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 233 +{ + texcoords 0.023438 0.117188 0.042969 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 234 +{ + texcoords 0.093750 0.117188 0.113281 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 235 +{ + texcoords 0.164062 0.117188 0.183594 0.144531; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 236 +{ + texcoords 0.242188 0.117188 0.250000 0.148438; + size 0.200 0.800; + offset 0.000 0.000; + advance 0.200; +}; +glyph 237 +{ + texcoords 0.312500 0.117188 0.320312 0.148438; + size 0.200 0.800; + offset 0.100 0.000; + advance 0.200; +}; +glyph 238 +{ + texcoords 0.378906 0.117188 0.390625 0.148438; + size 0.300 0.800; + offset 0.000 0.000; + advance 0.200; +}; +glyph 239 +{ + texcoords 0.449219 0.117188 0.460938 0.144531; + size 0.300 0.700; + offset 0.000 0.000; + advance 0.200; +}; +glyph 240 +{ + texcoords 0.515625 0.117188 0.535156 0.152344; + size 0.500 0.900; + offset 0.100 0.000; + advance 0.600; +}; +glyph 241 +{ + texcoords 0.585938 0.117188 0.605469 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 242 +{ + texcoords 0.656250 0.117188 0.675781 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 243 +{ + texcoords 0.726562 0.117188 0.746094 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 244 +{ + texcoords 0.796875 0.117188 0.816406 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 245 +{ + texcoords 0.867188 0.117188 0.886719 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 246 +{ + texcoords 0.937500 0.117188 0.957031 0.144531; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 247 +{ + texcoords 0.019531 0.050781 0.046875 0.070312; + size 0.700 0.500; + offset 0.100 0.100; + advance 0.800; +}; +glyph 248 +{ + texcoords 0.089844 0.042969 0.117188 0.070312; + size 0.700 0.700; + offset 0.000 -0.100; + advance 0.600; +}; +glyph 249 +{ + texcoords 0.164062 0.046875 0.183594 0.078125; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 250 +{ + texcoords 0.234375 0.046875 0.253906 0.078125; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 251 +{ + texcoords 0.304688 0.046875 0.324219 0.078125; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 252 +{ + texcoords 0.375000 0.046875 0.394531 0.074219; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 253 +{ + texcoords 0.441406 0.039062 0.468750 0.078125; + size 0.700 1.000; + offset 0.000 -0.200; + advance 0.600; +}; +glyph 254 +{ + texcoords 0.515625 0.039062 0.535156 0.078125; + size 0.500 1.000; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 255 +{ + texcoords 0.582031 0.039062 0.609375 0.074219; + size 0.700 0.900; + offset 0.000 -0.200; + advance 0.600; +}; diff --git a/dejavu-10.tex b/dejavu-10.tex new file mode 100644 index 0000000..c7f5313 Binary files /dev/null and b/dejavu-10.tex differ diff --git a/source/host.cpp b/source/host.cpp new file mode 100644 index 0000000..be24f05 --- /dev/null +++ b/source/host.cpp @@ -0,0 +1,95 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "host.h" +#include "netvis.h" + +using namespace std; +using namespace Msp; + +Host::Host(NetVis &nv, unsigned a): + netvis(nv), + addr(a) +{ + in_addr ina; + ina.s_addr=htonl(addr); + name=inet_ntoa(ina); +} + +void Host::set_position(const Vector2 &p) +{ + pos=p; +} + +void Host::add_connection(Connection &) +{ +} + +Connection *Host::get_connection(Host &) +{ + return 0; +} + +void Host::tick(const Msp::Time::TimeDelta &td) +{ + float dt=td/Msp::Time::sec; + + const map &hosts=netvis.get_hosts(); + float fx=-pos.x*0.1; + float fy=-pos.y*0.1; + for(map::const_iterator i=hosts.begin(); i!=hosts.end(); ++i) + { + if(i->second!=this) + { + const Vector2 &other_pos=i->second->get_position(); + float dx=other_pos.x-pos.x; + float dy=other_pos.y-pos.y; + float d2=dx*dx+dy*dy; + float d=sqrt(d2); + + unsigned other_addr=i->second->get_address(); + unsigned matching_bits=0; + for(unsigned j=32; (j-- && !((addr^other_addr)>>j));) + ++matching_bits; + + float nearness=24-min(matching_bits, 24U); + float f=10000.0*(1.0/(60+nearness*15)-1.0/d); + + fx+=dx/d*f; + fy+=dy/d*f; + } + } + + if(fx<-4 || fx>4) + pos.x+=fx*dt; + if(fy<-4 || fy>4) + pos.y+=fy*dt; +} + +void Host::render() const +{ + GL::push_matrix(); + GL::translate(static_cast(pos.x), static_cast(pos.y), 0); + + GL::Immediate imm((GL::COLOR4_UBYTE, GL::VERTEX2)); + imm.begin(GL::QUADS); + imm.color(1.0f, 1.0f, 1.0f, 1.0f); + imm.vertex(-5, -5); + imm.vertex(5, -5); + imm.vertex(5, 5); + imm.vertex(-5, 5); + imm.end(); + + const GL::Font &font=netvis.get_font(); + GL::translate(-static_cast(font.get_string_width(name)*5), 6, 0); + GL::scale_uniform(10); + font.draw_string(name); + GL::Texture::unbind(); + + GL::pop_matrix(); +} diff --git a/source/host.h b/source/host.h new file mode 100644 index 0000000..60dc547 --- /dev/null +++ b/source/host.h @@ -0,0 +1,37 @@ +#ifndef HOST_H_ +#define HOST_H_ + +#include +#include +#include +#include "vector2.h" + +class Connection; +class NetVis; + +class Host +{ +private: + NetVis &netvis; + unsigned addr; + std::string name; + Vector2 pos; + bool visible; + std::map connections; + +public: + Host(NetVis &, unsigned); + void set_position(const Vector2 &); + unsigned get_address() const { return addr; } + const std::string &get_name() const { return name; } + const Vector2 &get_position() const { return pos; } + bool get_visible() const { return visible; } + + void add_connection(Connection &); + Connection *get_connection(Host &); + + void tick(const Msp::Time::TimeDelta &); + void render() const; +}; + +#endif diff --git a/source/netvis.cpp b/source/netvis.cpp new file mode 100644 index 0000000..711788b --- /dev/null +++ b/source/netvis.cpp @@ -0,0 +1,192 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "host.h" +#include "netvis.h" +#include "packet.h" + +using namespace std; +using namespace Msp; + +NetVis::NetVis(int /*argc*/, char **argv) +{ + iface=argv[1]; +} + +int NetVis::main() +{ + char err[1024]; + pcap=pcap_open_live(iface.c_str(), 128, true, 0, err); + if(!pcap) + throw Exception(err); + + if(pcap_setnonblock(pcap, true, err)==-1) + throw Exception(err); + + dpy=new Graphics::Display; + wnd=new Graphics::Window(*dpy, 1024, 768); + glc=new Graphics::GLContext(*wnd); + wnd->set_title("NetVis"); + wnd->show(); + + GL::enable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + font=new GL::Font; + DataFile::load(*font, "dejavu-10.font"); + font_tex=new GL::Texture2D; + DataFile::load(*font_tex, "dejavu-10.tex"); + font->set_texture(*font_tex); + + Application::main(); + + delete glc; + delete wnd; + delete dpy; + + return exit_code; +} + +void NetVis::tick() +{ + Msp::Time::TimeStamp t=Msp::Time::now(); + if(!last_tick) + last_tick=t; + Msp::Time::TimeDelta dt=t-last_tick; + last_tick=t; + + dpy->tick(); + + pcap_dispatch(pcap, -1, &capture_handler, reinterpret_cast(this)); + + glClear(GL_COLOR_BUFFER_BIT); + + GL::matrix_mode(GL::PROJECTION); + GL::load_identity(); + GL::ortho_centered(1024, 768); + GL::matrix_mode(GL::MODELVIEW); + GL::load_identity(); + + for(map::iterator i=hosts.begin(); i!=hosts.end(); ++i) + { + i->second->tick(dt); + i->second->render(); + } + for(list::iterator i=packets.begin(); i!=packets.end();) + { + (*i)->tick(dt); + (*i)->render(); + if((*i)->get_stale()) + { + delete *i; + i=packets.erase(i); + } + else + ++i; + } + + GL::translate(-500, 360, 0); + for(map::iterator i=port_colors.begin(); i!=port_colors.end(); ++i) + { + GL::Color &color=i->second; + + GL::push_matrix(); + + GL::Immediate imm((GL::COLOR4_UBYTE,GL::VERTEX2)); + imm.begin(GL::QUADS); + imm.color(color.r, color.g, color.b, color.a); + for(float x=0; x<0.5; x+=0.2) + { + imm.vertex(x+0, 0); + imm.vertex(x+10, 0); + imm.vertex(x+10, 10); + imm.vertex(x+0, 10); + } + imm.end(); + + GL::translate(15, 1, 0); + GL::scale_uniform(10); + glColor4f(1.0, 1.0, 1.0, 1.0); + font->draw_string(format("%d", i->first)); + GL::Texture::unbind(); + + GL::pop_matrix(); + GL::translate(0, -12, 0); + } + + glc->swap_buffers(); +} + +Host &NetVis::get_host(unsigned a) +{ + map::iterator i=hosts.find(a); + if(i!=hosts.end()) + return *i->second; + + Host *host=new Host(*this, a); + host->set_position(Vector2(rand()*30.0/RAND_MAX-15.0, rand()*20.0/RAND_MAX-10.0)); + hosts[a]=host; + return *host; +} + +GL::Color &NetVis::get_port_color(unsigned port) +{ + map::iterator i=port_colors.find(port); + if(i!=port_colors.end()) + return i->second; + + GL::Color color; + while(1) + { + color.r=rand()*1.0/RAND_MAX; + color.g=rand()*1.0/RAND_MAX; + color.b=rand()*1.0/RAND_MAX; + if(color.r>0.5 || color.g>0.5 || color.b>0.7) + break; + } + color.a=0.4f; + return port_colors[port]=color; +} + +void NetVis::capture_handler(unsigned char *user, const pcap_pkthdr *, const unsigned char *data) +{ + NetVis *self=reinterpret_cast(user); + + const ethhdr *eth=reinterpret_cast(data); + if(ntohs(eth->h_proto)==ETH_P_IP) + { + const iphdr *ip=reinterpret_cast(eth+1); + + //cout<<"IP packet of "<len<<'/'<tot_len)<<" bytes\n"; + + unsigned port=0; + if(ip->protocol==IPPROTO_TCP) + { + const tcphdr *tcp=reinterpret_cast(ip+1); + port=min(ntohs(tcp->source), ntohs(tcp->dest)); + } + else if(ip->protocol==IPPROTO_UDP) + { + const udphdr *udp=reinterpret_cast(ip+1); + port=min(ntohs(udp->source), ntohs(udp->dest)); + } + Host &shost=self->get_host(ntohl(ip->saddr)); + Host *dhost=0; + if((ntohl(ip->daddr)&0xFF)!=0xFF) + dhost=&self->get_host(ntohl(ip->daddr)); + self->packets.push_back(new Packet(shost, dhost, self->get_port_color(port), ntohs(ip->tot_len))); + } +} + +Application::RegApp NetVis::reg; diff --git a/source/netvis.h b/source/netvis.h new file mode 100644 index 0000000..daec1cf --- /dev/null +++ b/source/netvis.h @@ -0,0 +1,48 @@ +#ifndef NETVIS_H_ +#define NETVIS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Packet; +class Host; + +class NetVis: public Msp::Application +{ +private: + std::string iface; + pcap_t *pcap; + std::list packets; + std::map hosts; + Msp::Graphics::Display *dpy; + Msp::Graphics::Window *wnd; + Msp::Graphics::GLContext *glc; + Msp::Time::TimeStamp last_tick; + std::map port_colors; + Msp::GL::Font *font; + Msp::GL::Texture2D *font_tex; + +public: + NetVis(int, char **); + int main(); + const Msp::GL::Font &get_font() const { return *font; } + const std::map &get_hosts() const { return hosts; } +private: + virtual void tick(); + Host &get_host(unsigned); + Msp::GL::Color &get_port_color(unsigned); + + static void capture_handler(unsigned char *, const pcap_pkthdr *, const unsigned char *); + + static Application::RegApp reg; +}; + +#endif diff --git a/source/packet.cpp b/source/packet.cpp new file mode 100644 index 0000000..491e807 --- /dev/null +++ b/source/packet.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include +#include "host.h" +#include "packet.h" + +using namespace Msp; + +Packet::Packet(const Host &s, const Host *d, const GL::Color &c, unsigned i): + src(s), + dest(d), + color(c), + x(0), + size(cbrt(i)), + angle(rand()*180.0/RAND_MAX), + rspeed(rand()*180.0/RAND_MAX-90.0) +{ +} + +void Packet::tick(const Time::TimeDelta &dt) +{ + double f=dt/Time::sec; + x+=f; + if(x>1) + x=1; + angle+=rspeed*f; + if(angle<0) + angle+=360; + if(angle>=360) + angle-=360; +} + +void Packet::render() const +{ + GL::push_matrix(); + + const Vector2 &spos=src.get_position(); + + if(dest) + { + const Vector2 &dpos=dest->get_position(); + GL::translate(spos.x*(1-x)+dpos.x*x, spos.y*(1-x)+dpos.y*x, 0); + GL::rotate(angle, 0, 0, 1); + + GL::Immediate imm((GL::COLOR4_UBYTE,GL::VERTEX2)); + imm.begin(GL::QUADS); + imm.color(color.r, color.g, color.b, color.a); + imm.vertex(-size, -size); + imm.vertex(size, -size); + imm.vertex(size, size); + imm.vertex(-size, size); + imm.end(); + } + else + { + GL::translate(spos.x, spos.y, 0); + GL::Immediate imm((GL::COLOR4_UBYTE,GL::VERTEX2)); + imm.begin(GL::TRIANGLE_FAN); + imm.color(color.r, color.g, color.b, color.a*(1-x)); + imm.vertex(0, 0); + for(unsigned i=0; i<=24; ++i) + { + float a=i*M_PI/12; + imm.vertex(cos(a)*x*200, sin(a)*x*200); + } + imm.end(); + } + + GL::pop_matrix(); +} diff --git a/source/packet.h b/source/packet.h new file mode 100644 index 0000000..cfeb2df --- /dev/null +++ b/source/packet.h @@ -0,0 +1,27 @@ +#ifndef PACKET_H_ +#define PACKET_H_ + +#include +#include + +class Host; + +class Packet +{ +private: + const Host &src; + const Host *dest; + Msp::GL::Color color; + float x; + float size; + float angle; + float rspeed; + +public: + Packet(const Host &, const Host *, const Msp::GL::Color &, unsigned); + bool get_stale() const { return x>=1; } + void tick(const Msp::Time::TimeDelta &); + void render() const; +}; + +#endif diff --git a/source/vector2.h b/source/vector2.h new file mode 100644 index 0000000..0ff927c --- /dev/null +++ b/source/vector2.h @@ -0,0 +1,12 @@ +#ifndef VECTOR2_H_ +#define VECTOR2_H_ + +struct Vector2 +{ + float x, y; + + Vector2(): x(0), y(0) { } + Vector2(float x_, float y_): x(x_), y(y_) { } +}; + +#endif