Public Member Functions | |
WpcPacket () | |
Creates an empty WpcPacket. | |
WpcPacket (WpcPacket const &packet) | |
Creates a WpcPacket object as a copy from another. | |
WpcPacket (unsigned char *data, int len) | |
Creates a WpcPacket from raw data. | |
WpcPacket (int len) | |
Creates an empty WpcPacket required length. | |
WpcPacket & | operator= (WpcPacket &packet) |
Assign another WpcPacket object's contents to this one. | |
virtual | ~WpcPacket () |
Destroys the packet object. | |
int | Length () |
Gets packet length. | |
void | Assign (pcap_pkthdr hdr, unsigned char *data) |
Sets data from raw array. | |
void | Assign (bpf_u_int32 pktlen, unsigned char *data) |
Sets data from raw array. | |
virtual int | PayloadLength () |
Gets packet payload length. | |
virtual string & | Dump (bool printPayload=true) |
Dumps packet data to string representation. | |
virtual unsigned char * | GetData () |
Gets a pointer to the data (payload) of the WpcPacket. | |
unsigned char * | GetBuffer () |
Gets a pointer to the packet buffer. | |
pcap_pkthdr | GetHeader () |
Gets the header of the packet. | |
unsigned char & | operator[] (unsigned int pos) |
Direct access to packet data bytes This operator allows the direct access to whole packet data including headers, not only payload. To obtain payload data get pointer from GetData function. | |
void | Resize (unsigned int newLen) |
Change packet data length. | |
virtual bool | ReadyToSend (WpcAdapter *adapter=NULL) |
Prepare data to send. | |
WpcMacAddr & | eth_src () |
Gets source Ethernet MAC address. | |
void | eth_src (WpcMacAddr &addr) |
Sets source Ethernet MAC address. | |
void | eth_src (WpcAdapter &adapter) |
Sets source Ethernet MAC address. | |
WpcMacAddr & | eth_dst () |
Gets destination Ethernet MAC address. | |
void | eth_dst (WpcMacAddr &addr) |
Sets destination Ethernet MAC address. | |
unsigned short | eth_proto () |
Gets Ethernet protocol number. | |
void | eth_proto (unsigned short proto) |
Sets Ethernet protocol number. | |
bool | GetOption (WpcPktOptions code) |
Gets packet post-processing option. | |
void | SetOption (WpcPktOptions code, bool state=true) |
Sets packet post-processing option. | |
void | ResetOption (WpcPktOptions code) |
Clears packet post-processing option. | |
Protected Attributes | |
WPC_ETH_HDR * | m_ethHdr |
Maps data to ETH header structure. | |
pcap_pkthdr | m_header |
libpcap's packet header | |
unsigned int | m_dataLen |
Packet buffer length. | |
unsigned char * | m_data |
Packet buffer. | |
unsigned int | m_options |
Packet post-processing options. |
All properties to access Ethernet-header fields are have one important issue:
wpcCapture.cpp, and wpcPacket.cpp.
WpcPacket::WpcPacket | ( | ) |
Creates an empty WpcPacket.
WpcPacket::WpcPacket | ( | WpcPacket const & | packet | ) |
Creates a WpcPacket object as a copy from another.
WpcPacket::WpcPacket | ( | unsigned char * | data, | |
int | len | |||
) |
Creates a WpcPacket from raw data.
WpcPacket::WpcPacket | ( | int | len | ) |
Creates an empty WpcPacket required length.
WpcPacket::~WpcPacket | ( | ) | [virtual] |
Destroys the packet object.
void WpcPacket::Assign | ( | bpf_u_int32 | pktlen, | |
unsigned char * | data | |||
) |
Sets data from raw array.
void WpcPacket::Assign | ( | pcap_pkthdr | hdr, | |
unsigned char * | data | |||
) |
Sets data from raw array.
string & WpcPacket::Dump | ( | bool | printPayload = true |
) | [virtual] |
Dumps packet data to string representation.
Reimplemented in WpcIpPacket, WpcArpPacket, WpcTcpPacket, and WpcIcmpPacket.
void WpcPacket::eth_dst | ( | WpcMacAddr & | addr | ) |
Sets destination Ethernet MAC address.
WpcMacAddr & WpcPacket::eth_dst | ( | ) |
void WpcPacket::eth_proto | ( | unsigned short | proto | ) |
Sets Ethernet protocol number.
unsigned short WpcPacket::eth_proto | ( | ) |
void WpcPacket::eth_src | ( | WpcAdapter & | adapter | ) |
Sets source Ethernet MAC address.
void WpcPacket::eth_src | ( | WpcMacAddr & | addr | ) |
Sets source Ethernet MAC address.
WpcMacAddr & WpcPacket::eth_src | ( | ) |
unsigned char* WpcPacket::GetBuffer | ( | ) | [inline] |
Gets a pointer to the packet buffer.
This function returns whole packet data, include headers. To obtain packet payload call the GetData function.
unsigned char * WpcPacket::GetData | ( | ) | [virtual] |
Gets a pointer to the data (payload) of the WpcPacket.
Reimplemented in WpcIpPacket, WpcArpPacket, WpcTcpPacket, and WpcIcmpPacket.
pcap_pkthdr WpcPacket::GetHeader | ( | ) | [inline] |
Gets the header of the packet.
bool WpcPacket::GetOption | ( | WpcPktOptions | code | ) | [inline] |
Gets packet post-processing option.
If multiple options are given (by logical OR operation) function returns true if ALL these options are sets to true
int WpcPacket::Length | ( | ) | [inline] |
Assign another WpcPacket object's contents to this one.
unsigned char & WpcPacket::operator[] | ( | unsigned int | pos | ) |
Direct access to packet data bytes This operator allows the direct access to whole packet data including headers, not only payload. To obtain payload data get pointer from GetData function.
WpcError | if index is out of range |
int WpcPacket::PayloadLength | ( | void | ) | [virtual] |
Gets packet payload length.
Reimplemented in WpcIpPacket, WpcArpPacket, WpcTcpPacket, and WpcIcmpPacket.
bool WpcPacket::ReadyToSend | ( | WpcAdapter * | adapter = NULL |
) | [virtual] |
Prepare data to send.
Prepare WpcPacket to send through network. Implements "last minute" checks and necessary processing (checksum calculation, for example)
Reimplemented in WpcIpPacket, WpcTcpPacket, and WpcIcmpPacket.
void WpcPacket::ResetOption | ( | WpcPktOptions | code | ) | [inline] |
Clears packet post-processing option.
If multiple options are given (by logical OR operation) function sets ALL these options to false
void WpcPacket::Resize | ( | unsigned int | newLen | ) |
void WpcPacket::SetOption | ( | WpcPktOptions | code, | |
bool | state = true | |||
) |
Sets packet post-processing option.
If multiple options are given (by logical OR operation) function sets ALL these options to true
unsigned char* WpcPacket::m_data [protected] |
Packet buffer.
unsigned int WpcPacket::m_dataLen [protected] |
Packet buffer length.
WPC_ETH_HDR* WpcPacket::m_ethHdr [protected] |
Maps data to ETH header structure.
pcap_pkthdr WpcPacket::m_header [protected] |
libpcap's packet header
unsigned int WpcPacket::m_options [protected] |
Packet post-processing options.
©2009 Positive Technologies |
Generated on Fri May 22 18:17:01 2009 for wpcObj by |
|
1.5.7 |
|