WpcTcpPacket Class Reference
[Classes hierarchy]

Implements protocol-specific fields for TCP packets. More...

Inheritance diagram for WpcTcpPacket:

WpcIpPacket WpcPacket

List of all members.

Public Member Functions

 WpcTcpPacket (WpcPacket const &packet)
 Creates a WpcTcpPacket object as a copy from another.
 WpcTcpPacket (int size=sizeof(WPC_TCP_HDR))
 Creates an empty IP packet.
virtual string & Dump (bool printPayload=true)
 Dumps packet data to string representation.
virtual bool ReadyToSend (WpcAdapter *adapter=NULL)
 Prepare data to send.
virtual int PayloadLength ()
 Gets packet payload length.
virtual unsigned char * GetData ()
 Gets a pointer to the data (payload) of the WpcPacket.
unsigned short src_port ()
 Gets source port number.
void src_port (unsigned short val)
 Sets source port number.
unsigned short dst_port ()
 Gets destination port number.
void dst_port (unsigned short val)
 Sets destination port number.
unsigned int sequence ()
 Gets sequence number.
void sequence (unsigned int val)
 Sets sequence number.
unsigned int ack ()
 Gets acknowledge number.
void ack (unsigned int val)
 Sets acknowledge number.
WpcTcpOffset & off ()
 Gets TCP offset structure.
void off (WpcTcpOffset &val)
 Sets TCP offset structure.
WpcTcpFlags & flags ()
 Gets TCP flags structure.
void flags (WpcTcpFlags &val)
 Gets TCP flags structure.
unsigned short window ()
 Gets window size.
void window (unsigned short val)
 Sets window size.
unsigned short chksum ()
 Gets checksum.
void chksum (unsigned short val)
 Sets checksum.
unsigned short urg ()
 Gets urgent pointer.
void urg (unsigned short val)
 Sets urgent pointer.

Protected Attributes

WPC_TCP_HDRm_tcpHdr
 Maps data to TCP header structure.


Detailed Description

Implements protocol-specific fields for TCP packets.

All properties to access TCP-header fields are have one important issue:

Examples:

wpcPacket.cpp.


Constructor & Destructor Documentation

WpcTcpPacket::WpcTcpPacket ( WpcPacket const &  packet  )  [inline]

Creates a WpcTcpPacket object as a copy from another.

WpcTcpPacket::WpcTcpPacket ( int  size = sizeof(WPC_TCP_HDR)  )  [inline]

Creates an empty IP packet.


Member Function Documentation

void WpcTcpPacket::ack ( unsigned int  val  ) 

Sets acknowledge number.

unsigned int WpcTcpPacket::ack (  ) 

Gets acknowledge number.

void WpcTcpPacket::chksum ( unsigned short  val  ) 

Sets checksum.

Reimplemented from WpcIpPacket.

unsigned short WpcTcpPacket::chksum (  ) 

Gets checksum.

Reimplemented from WpcIpPacket.

void WpcTcpPacket::dst_port ( unsigned short  val  ) 

Sets destination port number.

unsigned short WpcTcpPacket::dst_port (  ) 

Gets destination port number.

string & WpcTcpPacket::Dump ( bool  printPayload = true  )  [virtual]

Dumps packet data to string representation.

Reimplemented from WpcIpPacket.

void WpcTcpPacket::flags ( WpcTcpFlags &  val  ) 

Gets TCP flags structure.

WpcTcpFlags & WpcTcpPacket::flags (  ) 

Gets TCP flags structure.

unsigned char * WpcTcpPacket::GetData (  )  [virtual]

Gets a pointer to the data (payload) of the WpcPacket.

Returns:
pointer to the packet payload, or NULL if the packet size less than header size

Reimplemented from WpcIpPacket.

void WpcTcpPacket::off ( WpcTcpOffset &  val  ) 

Sets TCP offset structure.

WpcTcpOffset & WpcTcpPacket::off (  ) 

Gets TCP offset structure.

int WpcTcpPacket::PayloadLength ( void   )  [virtual]

Gets packet payload length.

Returns:
Packet payload length, or NULL if the packet size less than header size

Reimplemented from WpcIpPacket.

bool WpcTcpPacket::ReadyToSend ( WpcAdapter adapter = NULL  )  [virtual]

Prepare data to send.

Calculate IP checksum.

Returns:
true if packet is ready to send false otherwise

Todo:
implement TCP checksum calculation and options processing

Reimplemented from WpcIpPacket.

void WpcTcpPacket::sequence ( unsigned int  val  ) 

Sets sequence number.

unsigned int WpcTcpPacket::sequence (  ) 

Gets sequence number.

void WpcTcpPacket::src_port ( unsigned short  val  ) 

Sets source port number.

unsigned short WpcTcpPacket::src_port (  ) 

Gets source port number.

void WpcTcpPacket::urg ( unsigned short  val  ) 

Sets urgent pointer.

unsigned short WpcTcpPacket::urg (  ) 

Gets urgent pointer.

void WpcTcpPacket::window ( unsigned short  val  ) 

Sets window size.

unsigned short WpcTcpPacket::window (  ) 

Gets window size.


Member Data Documentation

Maps data to TCP header structure.



 
©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