Skip to content

Commit

Permalink
initiali checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
blucia0a committed Mar 24, 2012
0 parents commit 7fdc9ed
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all: Streamy.c
g++ Streamy.c -std=c99 -g -o Streamy -framework CoreAudio -framework ApplicationServices -framework CoreMidi -framework AudioToolbox -framework AudioUnit
23 changes: 23 additions & 0 deletions Plan
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Pipeline:

Phase 1: tcpdump -tnn -c 20000 -ien1

produces output like:

IP 192.168.0.4.54953 > 173.194.33.21.443: Flags [P.], seq 2174803272:2174803309, ack 75913239, win 65535, options [nop,nop,TS val 64433140 ecr 1704041441], length 37

Can pipe that to...

-----

Phase 2: perl script.

Script should take lines in, and make a map of hosts. For each present host, there should be an associated (statically assigned? dynamically mapped?) MIDI instrument and/or tone. The script should output tuples like (MIDI cmd, instrument, tone, velocity,...). By specifying the MIDI command, other MIDI parameters could be varied by the output of this tool. Furthermore, there could be effects that we know about that, when certain events happen, could be modulated by traffic.

These will be piped to...

-----

Phase 3: a C MIDI driver

This will be hooked into CoreAudio. The program will loop on STDIN reading MIDI commands from Phase 2. When each tuple arrives, it is issued to the synth.
64 changes: 64 additions & 0 deletions Sift.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/perl
local $| = 1;
use warnings;
use strict;

my $num_clients = 0;
my %clientMap;
my %Map;

while(<>){

chomp;
my ($srcip,$dstip,$srcport,$dstport,$icmp) = split /\s+/;


if( defined $icmp ){
&addClientIfNew($srcip,$dstip);
&doCommunication($srcip,1,'send');
&doCommunication($dstip,1,'recv');
}

next if !defined $srcip;
next if !defined $dstip;
next if !defined $srcport;
next if !defined $dstport;


&addClientIfNew($srcip,$dstip);
&doCommunication($srcip,$srcport,'send');
&doCommunication($dstip,$dstport,'recv');

}

sub doCommunication(){

my $ip = shift;
my $port = shift;
my $direction = shift;

if( $direction eq 'send' ){
print "".$clientMap{$ip}." ".$port." 0\n";
}
if( $direction eq 'recv' ){
print "".$clientMap{$ip}." ".$port." 1\n";
}

}

sub addClientIfNew(){

my $srcip = shift;
my $dstip = shift;

if( !exists $clientMap{$srcip} ){
$clientMap{$srcip} = $num_clients++;
#print "New client: $srcip\n"
}

if( !exists $clientMap{$dstip} ){
$clientMap{$dstip} = $num_clients++;
#print "New client: $dstip\n"
}

}

0 comments on commit 7fdc9ed

Please sign in to comment.