Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
Public Member Functions | List of all members
TcpConnection Class Reference

TcpConnection for TCP connections made from TcpProcess's listen() and connect(). More...

Public Member Functions

ip getLocalIp ()
 Get local Ip Address. More...
 
ipv6 getLocalIpv6 ()
 Get local Ipv6 Address. More...
 
int getLocalPort ()
 Get local Port number. More...
 
ip getRemoteIp ()
 Get remote Ip Address. More...
 
ipv6 getRemoteIpv6 ()
 Get remote Ipv6 Address. More...
 
int getRemotePort ()
 Get remote port number. More...
 
string getRemoteIpString ()
 Get remote ip address in string format. More...
 
TcpConnectionState getState ()
 get the tcp connection state More...
 
void accept (bool)
 Accept the connection request. More...
 
bool close (FrameInstance)
 Close the current connection. More...
 
bool sendData (QString, FrameInstance)
 Sends data over this custom TCP process. More...
 
bool sendDataWithPduInfo (QString, FrameInstance, QString, QString, QString)
 Sends data over this custom TCP process. More...
 

Detailed Description

TcpConnection for TCP connections made from TcpProcess's listen() and connect().

Member Function Documentation

◆ accept()

void TcpConnection::accept ( bool  )

Accept the connection request.

Parameters
bAccepted,bool-true to accept and false to reject

◆ close()

bool TcpConnection::close ( FrameInstance  )

Close the current connection.

Parameters
frameInstance,theFrameInstance object to send back

◆ getLocalIp()

ip TcpConnection::getLocalIp ( )

Get local Ip Address.

Returns
ip, local ip address

◆ getLocalIpv6()

ipv6 TcpConnection::getLocalIpv6 ( )

Get local Ipv6 Address.

Returns
ipv6, local ipv6 address

◆ getLocalPort()

int TcpConnection::getLocalPort ( )

Get local Port number.

Returns
int, port number

◆ getRemoteIp()

ip TcpConnection::getRemoteIp ( )

Get remote Ip Address.

Returns
ip, remote ip address

◆ getRemoteIpString()

string TcpConnection::getRemoteIpString ( )

Get remote ip address in string format.

Returns
string, remote ip address

◆ getRemoteIpv6()

ipv6 TcpConnection::getRemoteIpv6 ( )

Get remote Ipv6 Address.

Returns
ipv6, remote ipv6 address

◆ getRemotePort()

int TcpConnection::getRemotePort ( )

Get remote port number.

Returns
int, remote port number

◆ getState()

TcpConnectionState TcpConnection::getState ( )

get the tcp connection state

Returns
enum<TcpConnectionState> CLOSED = 0, // Server received ACK from client and connection is closed. SYN_SENT = 1, // Indicates active open. SYN_RECEIVED = 2, // Server just received SYN from the client. ESTABLISHED = 3, // Client received server's SYN and session is established. LISTEN = 4, // Server is ready to accept connection. FIN_WAIT_1 = 5, // Indicates active close. TIMED_WAIT = 6, // Client enters this state after active close. CLOSE_WAIT = 7, // Indicates passive close. Server just received first FIN from a client. FIN_WAIT_2 = 8, // Client just received acknowledgment of its first FIN from the server. LAST_ACK = 9, // Server is in this state when it sends its own FIN. CLOSING = 10

◆ sendData()

bool TcpConnection::sendData ( QString  ,
FrameInstance   
)

Sends data over this custom TCP process.

Parameters
data,thedata to send to the destination.
frameInstance,theFrameInstance object. Use createFrameInstance() to create the FrameInstance object.
Returns
bool, true if successful, otherwise false.

◆ sendDataWithPduInfo()

bool TcpConnection::sendDataWithPduInfo ( QString  ,
FrameInstance  ,
QString  ,
QString  ,
QString   
)

Sends data over this custom TCP process.

Parameters
data,thedata to send to the destination.
frameInstance,theFrameInstance object. Use createFrameInstance() to create the FrameInstance object.
customProtocol,thecustom protocol name
customPduType,thecustom PDU type
jsonFields,thefields in JSON string representation:
Returns
bool, true if successful, otherwise false.

The documentation for this class was generated from the following file: