WpcAdapter::WpcAdapterInfo Class Reference

smart pointer to libpcap's structure pcap_t More...

Inheritance diagram for WpcAdapter::WpcAdapterInfo:

PtThread

List of all members.

Public Member Functions

 WpcAdapterInfo (string name)
 Create new WpcAdapterInfo object with given name.
 ~WpcAdapterInfo ()
virtual
WpcAdapter::WpcAdapterInfo
AddRef ()
 Lock the resource Increases references count to the interface, and initialize interface for first use.
int Release ()
 Free locked resource Decreases references count to the interface, and close interface on last use.
bool IsUsed ()
 Returns true if adapter in use, false otherwise.
 operator pcap_t * ()
 Returns the libpcap's object.
pcap_t * c_obj ()
 Returns the libpcap's object.
pcap_t const * c_obj () const
 Returns the libpcap's constant object.
string GetIfaceDesc ()
 Gets interface description.
void SetIfaceDesc (string desc)
 Sets interface description.
string GetErrorMsg ()
 Gets error description.
void SetIfaceFlags (u_int flags)
 Sets interface flags.
u_int GetIfaceFlags ()
 Gets interface flags.
void WpcCopyAddrs (pcap_addr *src)
 copy list of the pcap_addr to new location
WpcAddressListGetAddrs ()
 copy list of the pcap_addr to new location
void StartCapture (WpcAdapter *receiver)
 Adds WpcAdapter to the receivers list.
void StopCapture (WpcAdapter *receiver)
 Removes WpcAdapter from the receivers list.

Protected Member Functions

virtual DWORD Entry (LPVOID arg)
 Thread function to process capture loop.

Static Protected Member Functions

static void PacketHandler (u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
 Callback function invoked by libpcap for every incoming packet.

Protected Attributes

string m_name
 Symbolic interface name.
pcap_t * m_iface
 Inherited libpcap's interface object.
u_int m_flags
 Flags of the interface, provided by libpcap.
WpcAddressList m_addrs
 List of the addresses, assigned to the interface.
int m_refCount
 Counter of object usage.
char m_errbuf [PCAP_ERRBUF_SIZE]
 Buffer for the libpcap error messages.
string m_description
 Human readable interface name.
vector< WpcAdapter * > m_recvList
 Receivers list.
PtMutex m_recvMutex
 Control access to the receivers list.


Detailed Description

smart pointer to libpcap's structure pcap_t

WpcAdapterInfo wraps the libpcap's C structure pcap_t, and provide operations to multiple access to adapter.


Constructor & Destructor Documentation

WpcAdapter::WpcAdapterInfo::WpcAdapterInfo ( string  name  ) 

Create new WpcAdapterInfo object with given name.

WpcAdapter::WpcAdapterInfo::~WpcAdapterInfo (  ) 


Member Function Documentation

WpcAdapter::WpcAdapterInfo * WpcAdapter::WpcAdapterInfo::AddRef (  )  [virtual]

Lock the resource Increases references count to the interface, and initialize interface for first use.

pcap_t const* WpcAdapter::WpcAdapterInfo::c_obj (  )  const [inline]

Returns the libpcap's constant object.

pcap_t* WpcAdapter::WpcAdapterInfo::c_obj (  )  [inline]

Returns the libpcap's object.

DWORD WpcAdapter::WpcAdapterInfo::Entry ( LPVOID  arg  )  [protected, virtual]

Thread function to process capture loop.

Reimplemented from PtThread.

WpcAddressList* WpcAdapter::WpcAdapterInfo::GetAddrs (  )  [inline]

copy list of the pcap_addr to new location

string WpcAdapter::WpcAdapterInfo::GetErrorMsg (  )  [inline]

Gets error description.

string WpcAdapter::WpcAdapterInfo::GetIfaceDesc (  )  [inline]

Gets interface description.

u_int WpcAdapter::WpcAdapterInfo::GetIfaceFlags (  )  [inline]

Gets interface flags.

bool WpcAdapter::WpcAdapterInfo::IsUsed (  )  [inline]

Returns true if adapter in use, false otherwise.

WpcAdapter::WpcAdapterInfo::operator pcap_t * (  )  [inline]

Returns the libpcap's object.

void WpcAdapter::WpcAdapterInfo::PacketHandler ( u_char *  param,
const struct pcap_pkthdr *  header,
const u_char *  pkt_data 
) [static, protected]

Callback function invoked by libpcap for every incoming packet.

int WpcAdapter::WpcAdapterInfo::Release (  ) 

Free locked resource Decreases references count to the interface, and close interface on last use.

void WpcAdapter::WpcAdapterInfo::SetIfaceDesc ( string  desc  )  [inline]

Sets interface description.

void WpcAdapter::WpcAdapterInfo::SetIfaceFlags ( u_int  flags  )  [inline]

Sets interface flags.

void WpcAdapter::WpcAdapterInfo::StartCapture ( WpcAdapter receiver  ) 

Adds WpcAdapter to the receivers list.

Starts the capture loop if it doesn't started yet.

void WpcAdapter::WpcAdapterInfo::StopCapture ( WpcAdapter receiver  ) 

Removes WpcAdapter from the receivers list.

Stops the capture loop if no active receivers.

void WpcAdapter::WpcAdapterInfo::WpcCopyAddrs ( pcap_addr *  src  ) 

copy list of the pcap_addr to new location


Member Data Documentation

List of the addresses, assigned to the interface.

Human readable interface name.

char WpcAdapter::WpcAdapterInfo::m_errbuf[PCAP_ERRBUF_SIZE] [protected]

Buffer for the libpcap error messages.

Flags of the interface, provided by libpcap.

Inherited libpcap's interface object.

Symbolic interface name.

Receivers list.

Control access to the receivers list.

Counter of object usage.



 
©2009 Positive Technologies
 
Generated on Fri May 22 18:17:01 2009 for wpcObj by 
 
 
1.5.7
 
Get wpcObj at SourceForge.net. Fast, secure and Free Open Source software downloads