How to add pcap for packet capture?

Can I add file responsible for packet capture like pcap or packet socket to source code ? If yes, how and where should I add this file ?