73 lines
2.0 KiB
C
73 lines
2.0 KiB
C
|
|
#ifndef CMVR_ES_TEST_QUIC_GATEWAY_QUIC_TEST_GATEWAY_H
|
||
|
|
#define CMVR_ES_TEST_QUIC_GATEWAY_QUIC_TEST_GATEWAY_H
|
||
|
|
|
||
|
|
#include <cstddef>
|
||
|
|
#include <cstdint>
|
||
|
|
#include <memory>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace cmvr::test::quic_gateway {
|
||
|
|
|
||
|
|
enum class Scenario {
|
||
|
|
NORMAL,
|
||
|
|
REJECT_REGISTRATION,
|
||
|
|
DROP_HEARTBEAT_ACK,
|
||
|
|
WRONG_ACK_SESSION,
|
||
|
|
FATAL_PROTOCOL_ERROR,
|
||
|
|
NONFATAL_PROTOCOL_ERROR,
|
||
|
|
DATAGRAM_DISABLED,
|
||
|
|
};
|
||
|
|
|
||
|
|
const char* scenarioName(Scenario scenario);
|
||
|
|
bool parseScenario(const std::string& text, Scenario* scenario);
|
||
|
|
|
||
|
|
struct GatewayOptions {
|
||
|
|
std::string bind_address{"127.0.0.1"};
|
||
|
|
std::uint16_t port{4433};
|
||
|
|
std::string alpn{"cmvr-quic-edge/1"};
|
||
|
|
std::string certificate_file;
|
||
|
|
std::string private_key_file;
|
||
|
|
std::string ready_file;
|
||
|
|
std::string summary_file;
|
||
|
|
Scenario scenario{Scenario::NORMAL};
|
||
|
|
|
||
|
|
std::uint32_t heartbeat_interval_ms{0};
|
||
|
|
std::size_t maximum_control_frame_bytes{1024U * 1024U};
|
||
|
|
std::size_t maximum_reassembly_bytes{32U * 1024U * 1024U};
|
||
|
|
std::size_t maximum_reassembly_frames{128U};
|
||
|
|
std::size_t maximum_frame_bytes{8U * 1024U * 1024U};
|
||
|
|
std::size_t maximum_work_queue_bytes{8U * 1024U * 1024U};
|
||
|
|
std::uint32_t reassembly_timeout_ms{2000U};
|
||
|
|
|
||
|
|
// Zero disables the corresponding automatic completion condition.
|
||
|
|
std::uint64_t exit_after_registrations{0};
|
||
|
|
std::uint64_t exit_after_heartbeats{0};
|
||
|
|
std::uint64_t run_for_ms{0};
|
||
|
|
};
|
||
|
|
|
||
|
|
class QuicTestGateway {
|
||
|
|
public:
|
||
|
|
explicit QuicTestGateway(GatewayOptions options);
|
||
|
|
~QuicTestGateway();
|
||
|
|
|
||
|
|
QuicTestGateway(const QuicTestGateway&) = delete;
|
||
|
|
QuicTestGateway& operator=(const QuicTestGateway&) = delete;
|
||
|
|
|
||
|
|
bool start(std::string* error);
|
||
|
|
void stop();
|
||
|
|
|
||
|
|
std::uint16_t boundPort() const;
|
||
|
|
bool completionReached() const;
|
||
|
|
bool hasRuntimeFailure() const;
|
||
|
|
std::string lastError() const;
|
||
|
|
std::string summaryJson() const;
|
||
|
|
|
||
|
|
private:
|
||
|
|
class Impl;
|
||
|
|
std::unique_ptr<Impl> impl_;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace cmvr::test::quic_gateway
|
||
|
|
|
||
|
|
#endif // CMVR_ES_TEST_QUIC_GATEWAY_QUIC_TEST_GATEWAY_H
|