1#ifndef TURNLOADGENASYNCSOCKETHANDLER_HXX
2#define TURNLOADGENASYNCSOCKETHANDLER_HXX
4#if defined(HAVE_CONFIG_H)
8#include "../TurnAsyncSocket.hxx"
9#include "../TurnAsyncSocketHandler.hxx"
21 asio::io_context& ioService,
22 const Data& localAddress,
23 const Data& turnServerAddress,
24 unsigned short turnServerPort,
25 unsigned short relayPort,
36 virtual void onConnectSuccess(
unsigned int socketDesc,
const asio::ip::address& address,
unsigned short port)
override;
37 virtual void onConnectFailure(
unsigned int socketDesc,
const asio::error_code& e)
override;
38 virtual void onSharedSecretSuccess(
unsigned int socketDesc,
const char* username,
unsigned int usernameSize,
const char* password,
unsigned int passwordSize)
override;
41 virtual void onBindFailure(
unsigned int socketDesc,
const asio::error_code& e,
const StunTuple& stunServerTuple)
override;
43 virtual void onAllocationFailure(
unsigned int socketDesc,
const asio::error_code& e)
override;
44 virtual void onRefreshSuccess(
unsigned int socketDesc,
unsigned int lifetime)
override;
45 virtual void onRefreshFailure(
unsigned int socketDesc,
const asio::error_code& e)
override;
51 virtual void onChannelBindSuccess(
unsigned int socketDesc,
unsigned short channelNumber)
override;
54 virtual void onSendFailure(
unsigned int socketDesc,
const asio::error_code& e)
override;
55 virtual void onReceiveSuccess(
unsigned int socketDesc,
const asio::ip::address& address,
unsigned short port,
const std::shared_ptr<reTurn::DataBuffer>& data)
override;
56 virtual void onReceiveFailure(
unsigned int socketDesc,
const asio::error_code& e)
override;
61 asio::steady_timer mTimer;
62 asio::ip::address mLocalAddress;
64 unsigned short mTurnServerPort;
65 unsigned short mRelayPort;
67 std::shared_ptr<TurnAsyncSocket> mTurnAsyncSocket;
68 unsigned int mNumSends;
69 unsigned int mNumSendFailures;
70 unsigned int mNumReceiveSuccesses;
71 unsigned int mNumReceiveFailures;
75 int mDelayBetweenClientStartsMs;
76 int mAllocationTimeSecs;
77 int mAllocationLifetimeSecs;
78 int mTimeBetweenAllocationsSecs;
79 int mPayloadIntervalMs;
void sendAllocationRequest()
virtual void onSharedSecretSuccess(unsigned int socketDesc, const char *username, unsigned int usernameSize, const char *password, unsigned int passwordSize) override
virtual void onChannelBindRequestSent(unsigned int socketDesc, unsigned short channelNumber) override
virtual void onConnectSuccess(unsigned int socketDesc, const asio::ip::address &address, unsigned short port) override
virtual void onReceiveSuccess(unsigned int socketDesc, const asio::ip::address &address, unsigned short port, const std::shared_ptr< reTurn::DataBuffer > &data) override
virtual void onRefreshSuccess(unsigned int socketDesc, unsigned int lifetime) override
virtual void onAllocationSuccess(unsigned int socketDesc, const StunTuple &reflexiveTuple, const StunTuple &relayTuple, unsigned int lifetime, unsigned int bandwidth, uint64_t reservationToken) override
virtual void onSendFailure(unsigned int socketDesc, const asio::error_code &e) override
void startSendingPayload()
virtual void onSetActiveDestinationFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onChannelBindSuccess(unsigned int socketDesc, unsigned short channelNumber) override
virtual void onChannelBindFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onAllocationFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onRefreshFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onIncomingBindRequestProcessed(unsigned int socketDesc, const StunTuple &sourceTuple) override
virtual void onSendSuccess(unsigned int socketDesc) override
virtual void onReceiveFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onClearActiveDestinationSuccess(unsigned int socketDesc) override
void setTurnAsyncSocket(std::shared_ptr< TurnAsyncSocket > &turnAsyncSocket)
virtual void onClearActiveDestinationFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onBindFailure(unsigned int socketDesc, const asio::error_code &e, const StunTuple &stunServerTuple) override
virtual void onBindSuccess(unsigned int socketDesc, const StunTuple &reflexiveTuple, const StunTuple &stunServerTuple) override
virtual void onSetActiveDestinationSuccess(unsigned int socketDesc) override
virtual void onConnectFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual void onSharedSecretFailure(unsigned int socketDesc, const asio::error_code &e) override
virtual ~TurnLoadGenAsyncSocketHandler()
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t