mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine utest for DTLS
This commit is contained in:
parent
776f24cf3d
commit
e61391028e
1 changed files with 28 additions and 28 deletions
|
@ -843,28 +843,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DTLSServerFlowCase
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
|
|
||||||
string ClientVersion;
|
|
||||||
string ServerVersion;
|
|
||||||
|
|
||||||
bool ClientDone;
|
|
||||||
bool ServerDone;
|
|
||||||
|
|
||||||
bool ClientError;
|
|
||||||
bool ServerError;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::ostream& operator<< (std::ostream& stream, const DTLSServerFlowCase& c)
|
|
||||||
{
|
|
||||||
stream << "Case #" << c.id
|
|
||||||
<< ", client(" << c.ClientVersion << ",done=" << c.ClientDone << ",err=" << c.ClientError << ")"
|
|
||||||
<< ", server(" << c.ServerVersion << ",done=" << c.ServerDone << ",err=" << c.ServerError << ")";
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID TEST(KernelRTCTest, DTLSARQLimitTest)
|
VOID TEST(KernelRTCTest, DTLSARQLimitTest)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
@ -1181,11 +1159,33 @@ VOID TEST(KernelRTCTest, DTLSServerARQTest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct DTLSFlowCase
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
|
||||||
|
string ClientVersion;
|
||||||
|
string ServerVersion;
|
||||||
|
|
||||||
|
bool ClientDone;
|
||||||
|
bool ServerDone;
|
||||||
|
|
||||||
|
bool ClientError;
|
||||||
|
bool ServerError;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::ostream& operator<< (std::ostream& stream, const DTLSFlowCase& c)
|
||||||
|
{
|
||||||
|
stream << "Case #" << c.id
|
||||||
|
<< ", client(" << c.ClientVersion << ",done=" << c.ClientDone << ",err=" << c.ClientError << ")"
|
||||||
|
<< ", server(" << c.ServerVersion << ",done=" << c.ServerDone << ",err=" << c.ServerError << ")";
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
VOID TEST(KernelRTCTest, DTLSClientFlowTest)
|
VOID TEST(KernelRTCTest, DTLSClientFlowTest)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
DTLSServerFlowCase cases[] = {
|
DTLSFlowCase cases[] = {
|
||||||
// OK, Client, Server: DTLS v1.0
|
// OK, Client, Server: DTLS v1.0
|
||||||
{0, "dtls1.0", "dtls1.0", true, true, false, false},
|
{0, "dtls1.0", "dtls1.0", true, true, false, false},
|
||||||
// OK, Client, Server: DTLS v1.2
|
// OK, Client, Server: DTLS v1.2
|
||||||
|
@ -1204,8 +1204,8 @@ VOID TEST(KernelRTCTest, DTLSClientFlowTest)
|
||||||
{7, "dtls1.2", "dtls1.0", false, false, true, false},
|
{7, "dtls1.2", "dtls1.0", false, false, true, false},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(cases) / sizeof(DTLSServerFlowCase)); i++) {
|
for (int i = 0; i < (int)(sizeof(cases) / sizeof(DTLSFlowCase)); i++) {
|
||||||
DTLSServerFlowCase c = cases[i];
|
DTLSFlowCase c = cases[i];
|
||||||
|
|
||||||
MockDtlsCallback cio; SrsDtls client(&cio);
|
MockDtlsCallback cio; SrsDtls client(&cio);
|
||||||
MockDtlsCallback sio; MockDtls server(&sio);
|
MockDtlsCallback sio; MockDtls server(&sio);
|
||||||
|
@ -1229,7 +1229,7 @@ VOID TEST(KernelRTCTest, DTLSServerFlowTest)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
DTLSServerFlowCase cases[] = {
|
DTLSFlowCase cases[] = {
|
||||||
// OK, Client, Server: DTLS v1.0
|
// OK, Client, Server: DTLS v1.0
|
||||||
{0, "dtls1.0", "dtls1.0", true, true, false, false},
|
{0, "dtls1.0", "dtls1.0", true, true, false, false},
|
||||||
// OK, Client, Server: DTLS v1.2
|
// OK, Client, Server: DTLS v1.2
|
||||||
|
@ -1248,8 +1248,8 @@ VOID TEST(KernelRTCTest, DTLSServerFlowTest)
|
||||||
{7, "dtls1.2", "dtls1.0", false, false, true, false},
|
{7, "dtls1.2", "dtls1.0", false, false, true, false},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < (int)(sizeof(cases) / sizeof(DTLSServerFlowCase)); i++) {
|
for (int i = 0; i < (int)(sizeof(cases) / sizeof(DTLSFlowCase)); i++) {
|
||||||
DTLSServerFlowCase c = cases[i];
|
DTLSFlowCase c = cases[i];
|
||||||
|
|
||||||
MockDtlsCallback cio; MockDtls client(&cio);
|
MockDtlsCallback cio; MockDtls client(&cio);
|
||||||
MockDtlsCallback sio; SrsDtls server(&sio);
|
MockDtlsCallback sio; SrsDtls server(&sio);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue