#include <uwApplication_module.h>
◆ uwApplicationModule()
| uwApplicationModule::uwApplicationModule |
( |
| ) |
|
Constructor of uwApplicationModule class
References drop_out_of_order, dst_addr, MAX_READ_LEN, node_id, payloadsize, period, poisson_traffic, port_num, sea_trial, servPort, and sn_check.
◆ ~uwApplicationModule()
| uwApplicationModule::~uwApplicationModule |
( |
| ) |
|
|
virtual |
◆ acceptTCP()
| void uwApplicationModule::acceptTCP |
( |
| ) |
|
|
protectedvirtual |
◆ command()
| int uwApplicationModule::command |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| |
|
overridevirtual |
TCL command interpreter. It implements the following OTCL methods:
- Parameters
-
| argc | Number of arguments in argv. |
| argv | Array of strings which are the command parameters (Note that argv[0] is the name of the object). |
- Returns
- TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.
References acceptTCP(), chkTimerPeriod, GetFTT(), GetFTTstd(), GetPER(), getPktLost(), getPktRecv(), getPktSent(), getPktsInvalidRx(), getPktsOOSequence(), getPktsPushQueue(), GetRTT(), GetRTTstd(), GetTHR(), getTimeBeforeNextPkt(), listenTCP(), openConnectionUDP(), readFromUDP(), receiving, socket_active, socket_tcp, socket_thread, stop(), useTCP(), uwSendTimerAppl, and withoutSocket().
◆ getEpoch()
| std::string uwApplicationModule::getEpoch |
( |
| ) |
const |
|
inline |
Calculate the epoch of the event. Used in sea-trial mode.
- Returns
- the epoch of the system.
Referenced by printOnLog().
◆ GetFTT()
| double uwApplicationModule::GetFTT |
( |
| ) |
const |
|
virtual |
◆ GetFTTstd()
| double uwApplicationModule::GetFTTstd |
( |
| ) |
const |
|
virtual |
Return the standard deviation of the Forward Trip Time calculated
- Returns
- the standard deviation of the Forward Trip Time calculated
References fttsamples, sumftt, and sumftt2.
Referenced by command().
◆ GetPER()
| double uwApplicationModule::GetPER |
( |
| ) |
const |
|
virtual |
◆ getPeriod()
| virtual double uwApplicationModule::getPeriod |
( |
| ) |
const |
|
inlinevirtual |
Return period generation time.
- Returns
- period
References period.
◆ getPktLost()
| virtual int uwApplicationModule::getPktLost |
( |
| ) |
const |
|
inlinevirtual |
return the number of DATA packets lost by the server
- Returns
- pkts_lost
References pkts_lost.
Referenced by command().
◆ getPktRecv()
| virtual int uwApplicationModule::getPktRecv |
( |
| ) |
const |
|
inlinevirtual |
return the number of DATA packet correctly received by the server
- Returns
- pkts_recv
References pkts_recv.
Referenced by command().
◆ getPktSent()
| virtual int uwApplicationModule::getPktSent |
( |
| ) |
const |
|
inlinevirtual |
return the number of packets sent by the server
- Returns
- txsn
References txsn.
Referenced by command().
◆ getPktsInvalidRx()
| virtual int uwApplicationModule::getPktsInvalidRx |
( |
| ) |
const |
|
inlinevirtual |
return the number of DATA packets received with error by the server
- Returns
- pkts_invalid
References pkts_invalid.
Referenced by command().
◆ getPktsOOSequence()
| virtual int uwApplicationModule::getPktsOOSequence |
( |
| ) |
const |
|
inlinevirtual |
return the number of DATA packets received out of order by the server
- Returns
- pkts_ooseq
References pkts_ooseq.
Referenced by command().
◆ getPktsPushQueue()
| virtual int uwApplicationModule::getPktsPushQueue |
( |
| ) |
const |
|
inlinevirtual |
Return the number of DATA packets sorted in the server queue.
- Returns
- pkts_push_queue
References pkts_push_queue.
Referenced by command().
◆ GetRTT()
| double uwApplicationModule::GetRTT |
( |
| ) |
const |
|
virtual |
Returns the average Round Trip Time
- Returns
- the average Round Trip Time
References rttsamples, and sumrtt.
Referenced by command().
◆ GetRTTstd()
| double uwApplicationModule::GetRTTstd |
( |
| ) |
const |
|
virtual |
Return the standard deviation of the Round Trip Time calculated
- Returns
- the standard deviation of the Round Trip Time calculated
References rttsamples, sumrtt, and sumrtt2.
Referenced by command().
◆ GetTHR()
| double uwApplicationModule::GetTHR |
( |
| ) |
const |
|
virtual |
Return the Throughput calculated [bps]
- Returns
- Throughput [bps]
References sumbytes, and sumdt.
Referenced by command().
◆ getTimeBeforeNextPkt()
| double uwApplicationModule::getTimeBeforeNextPkt |
( |
| ) |
|
|
protectedvirtual |
Compute the DATA generation rate, that can be constant and equal to the period established by the user, or can occur with a Poisson process (only without socket).
- Returns
- generation period for DATA packets
References period, usePoissonTraffic(), and withoutSocket().
Referenced by command(), and transmit().
◆ incrPktInvalid()
| virtual void uwApplicationModule::incrPktInvalid |
( |
| ) |
|
|
inlineprotectedvirtual |
Increse the number of DATA packets received with error by the server
References pkts_invalid.
Referenced by recv().
◆ incrPktLost()
| virtual void uwApplicationModule::incrPktLost |
( |
int |
npkts | ) |
|
|
inlineprotectedvirtual |
Increase the number of DATA packets lost by the server
References pkts_lost.
Referenced by recv().
◆ incrPktOoseq()
| virtual void uwApplicationModule::incrPktOoseq |
( |
| ) |
|
|
inlineprotectedvirtual |
Increase the number of DATA packets received out of order by the server
References pkts_ooseq.
Referenced by recv().
◆ incrPktRecv()
| virtual void uwApplicationModule::incrPktRecv |
( |
| ) |
|
|
inlineprotectedvirtual |
Increase the number of DATA packet correctly received by the server
References pkts_recv.
Referenced by recv().
◆ incrPktSent()
| virtual void uwApplicationModule::incrPktSent |
( |
| ) |
|
|
inlineprotectedvirtual |
Increase the sequence number and so the number of packets sent by the server
References txsn.
Referenced by transmit().
◆ incrPktsPushQueue()
| virtual void uwApplicationModule::incrPktsPushQueue |
( |
| ) |
|
|
inlineprotectedvirtual |
Increase the number of DATA packets stored in the Server queue. This DATA packets will be sent to the below levels of ISO/OSI stack protocol.
References pkts_push_queue.
Referenced by readFromTCP(), and readFromUDP().
◆ listenTCP()
| bool uwApplicationModule::listenTCP |
( |
| ) |
|
|
protectedvirtual |
◆ openConnectionUDP()
| bool uwApplicationModule::openConnectionUDP |
( |
| ) |
|
|
protectedvirtual |
When socket communication is used, this method establish a connection between client and server. This is required because a UDP protocol is used.
- Returns
- true if the socket is bind.
References printOnLog(), servAddr, servPort, and servSockDescr.
Referenced by command().
◆ printOnLog()
| virtual void uwApplicationModule::printOnLog |
( |
LogLev |
log_level, |
|
|
const std::string & |
module, |
|
|
const std::string & |
message |
|
) |
| const |
|
inlineoverridevirtual |
◆ readFromTCP()
| void uwApplicationModule::readFromTCP |
( |
int |
clnSock | ) |
|
|
protectedvirtual |
◆ readFromUDP()
| void uwApplicationModule::readFromUDP |
( |
| ) |
|
|
protectedvirtual |
◆ recv()
| void uwApplicationModule::recv |
( |
Packet * |
p | ) |
|
|
overridevirtual |
Performs the reception of packets from upper and lower layers.
- Parameters
-
| Packet* | Pointer to the packet will be received. |
References clnSockDescr, esn, hrsn, incrPktInvalid(), incrPktLost(), incrPktOoseq(), incrPktRecv(), lrtime, hdr_DATA_APPLICATION::payload_msg, hdr_DATA_APPLICATION::payload_size(), printOnLog(), PT_DATA_APPLICATION, hdr_DATA_APPLICATION::rftt(), rftt, hdr_DATA_APPLICATION::rftt_valid_, hdr_DATA_APPLICATION::sn(), hdr_DATA_APPLICATION::sn_, sn_check, updateFTT(), updateRTT(), updateThroughput(), useDropOutOfOrder(), and withoutSocket().
◆ stop()
| void uwApplicationModule::stop |
( |
| ) |
|
|
protectedvirtual |
◆ transmit()
| void uwApplicationModule::transmit |
( |
| ) |
|
|
protectedvirtual |
Set all the field of the DATA packet that must be send down after the creation to the below level. In this case the payload of DATA packet are generated in a random way.
References chkTimerPeriod, hdr_uwip::daddr(), hdr_uwudp::dport(), dst_addr, getTimeBeforeNextPkt(), incrPktSent(), hdr_DATA_APPLICATION::payload_size(), payloadsize, port_num, printOnLog(), hdr_DATA_APPLICATION::priority(), PT_DATA_APPLICATION, queuePckReadTCP, queuePckReadUDP, hdr_DATA_APPLICATION::rftt(), rftt, hdr_DATA_APPLICATION::rftt_valid(), hdr_DATA_APPLICATION::sn(), txsn, uidcnt, useTCP(), and withoutSocket().
◆ updateFTT()
| void uwApplicationModule::updateFTT |
( |
double |
ftt | ) |
|
|
protectedvirtual |
Update the FTT after the reception of a new packet
- Parameters
-
| FTT | of the current packet received |
References fttsamples, sumftt, and sumftt2.
Referenced by recv().
◆ updateRTT()
| void uwApplicationModule::updateRTT |
( |
double |
rtt | ) |
|
|
protectedvirtual |
Update the RTT after the reception of a new packet
- Parameters
-
| RTT | of the current packet received |
References rttsamples, sumrtt, and sumrtt2.
Referenced by recv().
◆ updateThroughput()
| void uwApplicationModule::updateThroughput |
( |
int |
bytes, |
|
|
double |
dt |
|
) |
| |
|
protectedvirtual |
Update the Throughput after the reception of a new packet
- Parameters
-
| bytes | of the current packet received |
| dt | time since last rx of a packet |
References sumbytes, and sumdt.
Referenced by recv().
◆ useDropOutOfOrder()
| virtual bool uwApplicationModule::useDropOutOfOrder |
( |
| ) |
|
|
inlineprotectedvirtual |
If the communication take place without sockets verify if the data packets received by the server is out of order or not. In the first case discard the data packet.
- Returns
- true if enable drop out of order false otherwise.
References drop_out_of_order.
Referenced by recv().
◆ usePoissonTraffic()
| virtual bool uwApplicationModule::usePoissonTraffic |
( |
| ) |
|
|
inlineprotectedvirtual |
If the communication take place without sockets verify if the data generation period is constant or a poisson random process
- Returns
- true if use a Poisson process false if use a constant period data generation
References poisson_traffic.
Referenced by getTimeBeforeNextPkt().
◆ useTCP()
| virtual bool uwApplicationModule::useTCP |
( |
| ) |
|
|
inlineprotectedvirtual |
Check if the socket protocol is TCP or UDP.
- Returns
- true if socket uses TCP protocol false if uses UDP.
References socket_tcp.
Referenced by command(), and transmit().
◆ withoutSocket()
| virtual bool uwApplicationModule::withoutSocket |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ uwSendTimerAppl
◆ chkTimerPeriod
◆ clnAddr
| struct sockaddr_in uwApplicationModule::clnAddr |
|
protected |
◆ clnSockDescr
| int uwApplicationModule::clnSockDescr |
|
protected |
◆ drop_out_of_order
| int uwApplicationModule::drop_out_of_order |
|
protected |
◆ dst_addr
| uint8_t uwApplicationModule::dst_addr |
|
protected |
◆ esn
| uint32_t uwApplicationModule::esn |
|
protected |
◆ fttsamples
| int uwApplicationModule::fttsamples |
|
protected |
◆ hrsn
| int uwApplicationModule::hrsn |
|
protected |
Highest received sequence number.
Referenced by recv().
◆ lrtime
| double uwApplicationModule::lrtime |
|
protected |
Time of last packet reception.
Referenced by recv().
◆ MAX_READ_LEN
| uint uwApplicationModule::MAX_READ_LEN = 64 |
|
staticprotected |
◆ node_id
| int uwApplicationModule::node_id |
|
protected |
◆ payloadsize
| int uwApplicationModule::payloadsize |
|
protected |
◆ period
| double uwApplicationModule::period |
|
protected |
◆ pkts_invalid
| int uwApplicationModule::pkts_invalid |
|
protected |
◆ pkts_last_reset
| int uwApplicationModule::pkts_last_reset |
|
protected |
Used for error checking after stats are reset. Set to pkts_lost+pkts_recv each time resetStats is called.
◆ pkts_lost
| int uwApplicationModule::pkts_lost |
|
protected |
◆ pkts_ooseq
| int uwApplicationModule::pkts_ooseq |
|
protected |
◆ pkts_push_queue
| int uwApplicationModule::pkts_push_queue |
|
protected |
◆ pkts_recv
| int uwApplicationModule::pkts_recv |
|
protected |
◆ poisson_traffic
| int uwApplicationModule::poisson_traffic |
|
protected |
◆ port_num
| int uwApplicationModule::port_num |
|
protected |
◆ queuePckReadTCP
| std::queue<Packet *> uwApplicationModule::queuePckReadTCP |
|
protected |
Atomic boolean variable that controls the socket rx looping thread Queue that store the DATA packets recevied from the client by the server using a TCP protocol.
Referenced by readFromTCP(), and transmit().
◆ queuePckReadUDP
| std::queue<Packet *> uwApplicationModule::queuePckReadUDP |
|
protected |
Queue that store the DATA packets recevied from the client by the server using a UDP protocol.
Referenced by readFromUDP(), and transmit().
◆ receiving
| std::atomic<bool> uwApplicationModule::receiving |
|
protected |
◆ rftt
| int uwApplicationModule::rftt |
|
protected |
◆ rttsamples
| int uwApplicationModule::rttsamples |
|
protected |
◆ sea_trial
| int uwApplicationModule::sea_trial |
|
protected |
◆ servAddr
| struct sockaddr_in uwApplicationModule::servAddr |
|
protected |
◆ servPort
| int uwApplicationModule::servPort |
|
protected |
◆ servSockDescr
| int uwApplicationModule::servSockDescr |
|
protected |
◆ sn_check
| bool* uwApplicationModule::sn_check |
|
protected |
Flag set to true if the external application is connected via a TCP socket, false if UDP. Used to keep track of the packets already received.
Referenced by recv(), and uwApplicationModule().
◆ socket_active
| bool uwApplicationModule::socket_active |
|
protected |
◆ socket_mutex
| std::mutex uwApplicationModule::socket_mutex |
|
protected |
◆ socket_tcp
| bool uwApplicationModule::socket_tcp |
|
protected |
Flag set to true if packets are received from external application.
Referenced by command(), and useTCP().
◆ socket_thread
| std::thread uwApplicationModule::socket_thread |
|
protected |
◆ sumbytes
| double uwApplicationModule::sumbytes |
|
protected |
◆ sumdt
| double uwApplicationModule::sumdt |
|
protected |
◆ sumftt
| double uwApplicationModule::sumftt |
|
protected |
◆ sumftt2
| double uwApplicationModule::sumftt2 |
|
protected |
◆ sumrtt
| double uwApplicationModule::sumrtt |
|
protected |
◆ sumrtt2
| double uwApplicationModule::sumrtt2 |
|
protected |
◆ txsn
| int uwApplicationModule::txsn |
|
protected |
◆ uidcnt
| int uwApplicationModule::uidcnt |
|
protected |
Identifier counter that identify uniquely the DATA packet generated.
Referenced by transmit().
The documentation for this class was generated from the following files: