Codebase list sipp / 04b92bc5-46ff-4dc0-a9ad-c36567c8560d/main MEDIA.txt
04b92bc5-46ff-4dc0-a9ad-c36567c8560d/main

Tree @04b92bc5-46ff-4dc0-a9ad-c36567c8560d/main (Download .tar.gz)

MEDIA.txt @04b92bc5-46ff-4dc0-a9ad-c36567c8560d/mainraw · history · blame

This document describes changes added to sipp source code.
By Guillaume Teissier from FTR&D

For unstable version 2006-02-02
Erased libnet dependencies. UDP checksum are efficiently recomputed.
It will eases Windows port by the way. The spot is now focused on a raw
socket in send_packets.c.

Starts with unstable version 2005-30-11

DESCRIPTION
Adds media replay functionnality to sipp following tcpreplay strategy.
It needs a modification of XML script: see uac.xml for an example.
When launched, a play_pcap exec action will create a pthread for sending packets.
send_packets takes as arguments:
- a file name (pcap capture file, only unidirectional RTP streams)
- an interface name (eth0 for most Linux)
- two peers description (inet_addr)
Pcap file is processed and UDP packets are replayed on a different port.
Dest port is taken as a basis for port shifting.
An example: g711a.pcap has the following output
10.1.3.43:5000 -> 10.1.6.18:2006, stands for RTP G711A pt
the line play_pcap="g711a.pcap:lo:2006" will shift every UDP packet by
dest_port (original udp dest port) - base (0 in our test case).
The advantage is that RTCP and another RTP stream should be supported 
transparently.

PERFORMANCE
So far, on my DELL D410 laptop (800MHz / 1Go), it supports 500 simultaneous 
media comms (only audio).
When trying with -r 90, fails when more than ~500 comms are up, a memory alloc 
has failed.
Check the end of document for possible ways of enhancement

PREREQUISITES
libnet - tested with 1.1, there should be no worries about version > 1
libpcap - tested with 0.9.4
NOTE: sometimes pcap_next_ex is not compiled in libpcap, this may be useful 
to check this at make time.
NOTE2: I have no idea whether it is possible or not to inject raw packets, 
so it should not work on Windows.

ADDED FILES
send_packets.{h,c}: contains the thread function to send packets and export it.
The function send_packets is based on tcpreplay source code.
INDENTED with -bl -i2 options

MODIFIED FILES
Makefile: added send_packets.o, dependency for libnet and libpcap

call.hpp: added members to call class remote_ip_media (u32), remote_port_media 
(u16) and media_thread (pthread_t)
call.cpp: modified call constructor to initialize added members correctly. 
Added media information extracting function: get_remote_ip_media and 
get_remote_port_media in method process_incomming. Launch a **light** 
pthread when encounter a play_pcap action. Modified call::run method to make 
action on send msg.

sipp.hpp: added global configuration variable hasMedia, default to 0
sipp.cpp: disabled RTP mirror threads. Set RTP pkts and bytes/s to correct 
values (updated in send_packets.c)

scenario.cpp: set hasMedia to 1 when a tag play_pcap is encountered and set 
options. Added ability to execute a command
on a send tag ( to play media when sending back ACK to uas).

actions.hpp: added a new action called play_pcap, see syntax in uac.xml
actions.cpp: modified constructor and various accessors.

sipp.dtd: added a play_pcap tag for dtd validation

ENHANCEMENTS
- Opening both pcap_t descriptor and libnet_t descriptor for each call is too 
  much, see if mutualisation if possible:
	follow libnet_cq* check http://www.security-labs.org/index.php3?page=libnet
	and libnet_ng check http://www.security-labs.org/index.php3?page=libnetng
- Processing pcap file once for all should better
- Clean up and document