extract smtp, dns and ftp headers from pcap file

No replies
Joined: 11/20/2015

dear all
i have a pcap file and i want to read the smtp,ftp and dns headers in human readable format. for http i ca do it in this way:
if (packet.hasHeader(http)) {
Http h = packet.getHeader(http);
String s = new String(h.getHeader());

output is like this:

GET /show.aspx?s=4&u=635202019766428367 HTTP/1.1
Host: ads.goldiran.ir
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1

for other application layer protocols how can i do it??
could anyone please help me?
thanks a lot