It's unclear if you want to actually act on the data in the packet or just route it based on which computer sent it?
iptables can do the routing, and it's pretty sophisticated. It makes use of what are called "tables", ironically, and so you can interrogate and re-route the data as it passes through the various "tables".
See this tutorial for more info: http://wiki.centos.org/HowTos/Network/IPTables.
There are 3 primary tables but more can be added via plugins/modules and also custom ones can be developed too.
The primary ones:
So as a packet comes into the box it would pass through the "Input" table where it can be acted on. As packets flow out of the box they flow through the "Output" table and can be acted on their as well.
Take a look at this tutorial for more info on