miekg/pcap — pull request #5 by anoopk6 (2013-09-10 11:45:55+00:00)
Title: Pcap api additions

pcap_set_buffer_size api is required to set receive buffer size (linux default = 2 MB) . But this can be called only on handles which are not activated. On activated handles it fails with error 'can't perform operation on activated capture'. So create and activate has to be done in 2 steps using pcap_create and pcap_activate apis.

This commit adds wrappers for following pcap apis.
- pcap_create
- pcap_activate
- pcap_set_buffer_size
- pcap_set_promisc
- pcap_timeout
- pcap_set_snaplen

It also adds unit tests to test creation and configuration of pcap handles using pcap_open_live and pcap_create apis.
'sudo go test -v' is required for these unit tests as it captures packets from 'lo' interface.