Agora  1.2.0
Agora project
test_udp_client_server.cc File Reference
#include <gtest/gtest.h>
#include <atomic>
#include <string>
#include <thread>
#include "gettime.h"
#include "udp_client.h"
#include "udp_comm.h"
#include "udp_server.h"
#include "utils.h"
Include dependency graph for test_udp_client_server.cc:

Functions

void ClientSendTo (const std::string &src_address, uint16_t src_port, const std::string &dest_address, uint16_t dest_port)
 Test the non-connection use case (SendTo) More...
 
void ClientConnect (const std::string &src_address, uint16_t src_port, const std::string &dest_address, uint16_t dest_port)
 Test the connection use case. More...
 
void UDPSend (const std::string &local_address, uint16_t local_port, const std::string &remote_address, uint16_t remote_port)
 Test the connection use case. More...
 
void ServerRecvFrom (const std::string &src_address, uint16_t src_port, const std::string &dest_address, uint16_t dest_port)
 
void ServerConnect (const std::string &src_address, const uint16_t src_port, const std::string &dest_address, const uint16_t dest_port)
 
void UDPRecv (const std::string &local_address, uint16_t local_port, const std::string &remote_address, uint16_t remote_port)
 Test the connection use case. More...
 
 TEST (UDPClientServer, PerfIpv4)
 
 TEST (UDPClientServer, PerfIpv6)
 
 TEST (UDPClientServer, PerfIpv4RecvFrom)
 
 TEST (UDPComm, PerfUDP)
 
 TEST (UDPClientServer, ServerIsNonBlocking)
 
int main (int argc, char **argv)
 

Variables

static constexpr size_t kSendPort = 3195
 
static constexpr size_t kReceivePort = 3185
 
static constexpr size_t kMessageSize = 9000
 
static constexpr size_t kNumPackets = 10
 
static std::atomic< bool > server_ready = false
 
static const std::string kIpv4Address = "127.0.0.1"
 
static const std::string kIpv6Address = "::1"
 

Function Documentation

◆ ClientConnect()

void ClientConnect ( const std::string &  src_address,
uint16_t  src_port,
const std::string &  dest_address,
uint16_t  dest_port 
)

Test the connection use case.

Port will be selected by the system

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClientSendTo()

void ClientSendTo ( const std::string &  src_address,
uint16_t  src_port,
const std::string &  dest_address,
uint16_t  dest_port 
)

Test the non-connection use case (SendTo)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

◆ ServerConnect()

void ServerConnect ( const std::string &  src_address,
const uint16_t  src_port,
const std::string &  dest_address,
const uint16_t  dest_port 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ServerRecvFrom()

void ServerRecvFrom ( const std::string &  src_address,
uint16_t  src_port,
const std::string &  dest_address,
uint16_t  dest_port 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TEST() [1/5]

TEST ( UDPClientServer  ,
PerfIpv4   
)
Here is the call graph for this function:

◆ TEST() [2/5]

TEST ( UDPClientServer  ,
PerfIpv4RecvFrom   
)
Here is the call graph for this function:

◆ TEST() [3/5]

TEST ( UDPClientServer  ,
PerfIpv6   
)
Here is the call graph for this function:

◆ TEST() [4/5]

TEST ( UDPClientServer  ,
ServerIsNonBlocking   
)
Here is the call graph for this function:

◆ TEST() [5/5]

TEST ( UDPComm  ,
PerfUDP   
)
Here is the call graph for this function:

◆ UDPRecv()

void UDPRecv ( const std::string &  local_address,
uint16_t  local_port,
const std::string &  remote_address,
uint16_t  remote_port 
)

Test the connection use case.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UDPSend()

void UDPSend ( const std::string &  local_address,
uint16_t  local_port,
const std::string &  remote_address,
uint16_t  remote_port 
)

Test the connection use case.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kIpv4Address

const std::string kIpv4Address = "127.0.0.1"
static

◆ kIpv6Address

const std::string kIpv6Address = "::1"
static

◆ kMessageSize

constexpr size_t kMessageSize = 9000
staticconstexpr

◆ kNumPackets

constexpr size_t kNumPackets = 10
staticconstexpr

◆ kReceivePort

constexpr size_t kReceivePort = 3185
staticconstexpr

◆ kSendPort

constexpr size_t kSendPort = 3195
staticconstexpr

◆ server_ready

std::atomic<bool> server_ready = false
static