An objective-c wrapper around libpcap
=====================================
PcapKit was developed on OpenBSD, using the libpcap that comes with the base
installation.

Supported functionality
-----------------------

 * reading from a pcap dump file
 * sniffing on an interface
 * autodection of devices usable for sniffing
 * setting the interface into promiscuous mode
 * checking if interface supports RFMon and set interface into RFMon mode

How to use PcapKit
------------------
 * initialize a PcapKit instance:
   PcapKit *sniffer;
   sniffer = [[PcapKit alloc] init];
 * tell it whether to read from input file, or from a device, or try find
   a device automatically:
   [sniffer setInputFile:inputFile];
   [sniffer setDevice:device];
   [sniffer lookupDevice];
 * configure basic parameters of the sniffer instance:
   [sniffer setReadTimeout:readTimeout];
   [sniffer setBpfFilter:bpfFilter];
   [sniffer setOptimizeFilter:optimizeFilter];
   [sniffer setPromiscuous:promiscuous]; (only for live capture)
 * start reading from the file, or the live stream:
   [sniffer openOfflineStream];
   [sniffer openLiveStream];
 * apply the filter, set the delegate, and start the pcap loop:
   [sniffer applyFilter];
   [sniffer setDelegate:self];
   [sniffer startPcapLoop];

 * the tool or application using PcapKit needs to implement the PcapKitDelegate
   protocol, containing the following method:
   -(void) handlePacket: (NSData *) _packet;
   This method is called every time a new packet is sniffed matching the
   configured bpfFilter

 * NOTE: the sniffer cannot run in the main thread of an application, or
   a tool that has a NSRunLoop. In that case, either the tool must start
   the NSRunLoop in a different thread, or the pcap loop must be run in
   a separate thread. If the tool doesn't have a NSRunLoop, then this doesn't
   matter.

Implemented function wrappers
-----------------------------
More about the pcap functions you find in the corresponding
pcap(3) manual page.

pcap_open_live
 - implemented in -(void) openLiveStream;
pcap_open_offline
 - implemented in -(void) openOfflineStream;
pcap_dump_open
 - not implemented
pcap_dump_fopen
 - not implemented
pcap_lookupdev
 - implemented in -(BOOL)lookupDevice;
pcap_lookupnet
 - implemented in (NSInteger)lookupNetmask;
pcap_dispatch
 - not implemented
pcap_loop
 - implemented in -(NSInteger) startPcapLoop;
pcap_dump
 - not implemented
pcap_inject
 - not implemented
pcap_sendpacket
 - not needed, its only alternate implementation of pcap_inject
pcap_compile
 - implemented/used in -(BOOL)applyFilter;
pcap_setfilter
 - implemented/used in -(BOOL)applyFilter;
pcap_freecode
 - implemented/used in -(BOOL)applyFilter;
pcap_next
 - not implemented
pcap_next_ex
 - not implemented
pcap_setdirection
 - implemented in - (void) setDirection;
pcap_datalink
 - implemented in -(NSInteger) dataLink;
pcap_snapshot
 - implemented in -(NSInteger)getSnaplen;
pcap_is_swapped
 - implemented in -(BOOL)isSavefileSwapped;
pcap_major_version
 - implemented in -(NSInteger) getMajorVersion;
pcap_minor_version
 - implemented in -(NSInteger) getMinorVersion;
pcap_stats
 - not implemented
pcap_file
 - not implemented
pcap_fileno
 - not implemented
pcap_get_selectable_fd
 - not implemented
pcap_perror
 - implemented in -(void) printErrorWithPrefix:(NSString *)_prefix;
pcap_geterr
 - implemented in -(NSString *)getErrorString;
pcap_strerror
 - implemented in +(NSString *)getErrorStringForType:(NSInteger)_type;
pcap_close
 - used in - (void) dealloc;
pcap_dump_file
 - not implemented
pcap_dump_ftell
 - not implemented
pcap_dump_flush
 - not implemented
pcap_dump_close
 - not implemented
pcap_breakloop
 - implemented in -(void) stopPcapLoop;
pcap_findalldevs
 - not implemented
pcap_freealldevs
 - not implemented
pcap_getnonblock
 - not implemented
pcap_setnonblock
 - not implemented
pcap_set_datalink
 - implemented in - (void) setDataLink: (NSInteger)_dlt;
pcap_list_datalinks
 - implemented in -(NSInteger) getDatalinksIntoArray:(int **)_dlts;
pcap_open_dead
 - not implemented
pcap_fopen_offline
 - not implemented
pcap_lib_version
 - implemented in +(NSString *) getPcapLibraryVersion;
pcap_datalink_val_to_name
 - implemented in +(NSString *) getDataLinkNameForType:(NSInteger) _type;
pcap_datalink_val_to_description
 - implemented in +(NSString *) getDataLinkDescriptionForType:(NSInteger)_type;
pcap_datalink_name_to_val
 - implemented in +(NSInteger) getDataLinkTypeForName:(NSString *) _name;
pcap_create
 - implemented in -(BOOL) createSniffingHandle;
pcap_set_snaplen
 - implemented in -(BOOL) setSnaplen(NSInteger)_snaplen;
pcap_set_promisc
 - implemented in -(BOOL)enablePromiscuousMode:(BOOL)_flag;
 - implemented in -(void) setPromisc:(BOOL)_promisc;
pcap_can_set_rfmon
 - implemented in -(BOOL)checkSetRFMon;
pcap_set_rfmon
 - implemented in -(BOOL)setRFMon;
pcap_set_timeout
 - implemented in - (void) setReadTimeout:(NSInteger) _rt;
pcap_set_buffer_size
 - implemented in - (void) setBufsize:(NSInteger)_bufsize;
pcap_activate
 - implemented in -(NSInteger) activateSniffingHandle;
pcap_statustostr
 - implemented in +(NSString *) getStringFromStatus:(NSInteger *)_status;
