Dummynet is an infrastructure in FreeBSD that supports introducing delays and bandwidth constraints on specific "pipes". Pipes are an abstraction for filtering packets. The "DIRT" kernel installed on traffic machines should include dummynet (activated through a kernel configuration option - DUMMYNET).
For info on dummynet see the web page (or a local copy in case it goes away). Also, the ipfw and dummynet man pages help.
Additionally, there's a perl library in /usr/dirt/lib/perl/dummynet.pl that provides a few dummynet functions.
There's also /usr/dirt/bin/set_dummy_delay (use -help to get details) that allows you to set delays from the command line.
NOTE:You really need to think about the rules you specify since pipes can combine and the "any" operators can come into play to apply more delay or bandwidth constraint than you may intend.