mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9067 from kegilbert/socket-stats-name-conform
Move socket-stats-enable config to socket-stats-enabledpull/9909/head
commit
c9192b9029
|
@ -37,7 +37,7 @@ namespace {
|
|||
Timer tc_bucket; // Timer to limit a test cases run time
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
mbed_stats_socket_t tcp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
#endif
|
||||
|
||||
|
@ -126,7 +126,7 @@ int split2half_rmng_tcp_test_time()
|
|||
return (tcp_global::TESTS_TIMEOUT - tc_bucket.read()) / 2;
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int fetch_stats()
|
||||
{
|
||||
return SocketStats::mbed_stats_socket_get_each(&tcp_stats[0], MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT);
|
||||
|
|
|
@ -25,7 +25,7 @@ void fill_tx_buffer_ascii(char *buff, size_t len);
|
|||
nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket &sock);
|
||||
nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
extern mbed_stats_socket_t tcp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
int fetch_stats(void);
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_ADDRESS()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -49,7 +49,7 @@ void TCPSOCKET_BIND_ADDRESS()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_ADDRESS_INVALID()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -55,7 +55,7 @@ void TCPSOCKET_BIND_ADDRESS_INVALID()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_ADDRESS_NULL()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -48,7 +48,7 @@ void TCPSOCKET_BIND_ADDRESS_NULL()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_ADDRESS_PORT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -48,7 +48,7 @@ void TCPSOCKET_BIND_ADDRESS_PORT()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_PORT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -48,7 +48,7 @@ void TCPSOCKET_BIND_PORT()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_PORT_FAIL()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -58,7 +58,7 @@ void TCPSOCKET_BIND_PORT_FAIL()
|
|||
delete sock;
|
||||
delete sock2;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_UNOPENED()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -47,7 +47,7 @@ void TCPSOCKET_BIND_UNOPENED()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_BIND_WRONG_TYPE()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -57,7 +57,7 @@ void TCPSOCKET_BIND_WRONG_TYPE()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -125,7 +125,7 @@ void tcpsocket_echotest_nonblock_receive()
|
|||
|
||||
void TCPSOCKET_ECHOTEST_NONBLOCK()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int j = 0;
|
||||
int count = fetch_stats();
|
||||
for (; j < count; j++) {
|
||||
|
@ -179,7 +179,7 @@ void TCPSOCKET_ECHOTEST_NONBLOCK()
|
|||
}
|
||||
bytes2send -= sent;
|
||||
}
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (j = 0; j < count; j++) {
|
||||
if ((tcp_stats[j].state == SOCK_OPEN) && (tcp_stats[j].proto == NSAPI_TCP)) {
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_OPEN_CLOSE_REPEAT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -42,7 +42,7 @@ void TCPSOCKET_OPEN_CLOSE_REPEAT()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
|
||||
}
|
||||
delete sock;
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_OPEN_DESTRUCT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -41,7 +41,7 @@ void TCPSOCKET_OPEN_DESTRUCT()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
delete sock;
|
||||
}
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -70,7 +70,7 @@ void TCPSOCKET_OPEN_LIMIT()
|
|||
break;
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
int open_count = 0;
|
||||
for (int j = 0; j < count; j++) {
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void TCPSOCKET_OPEN_TWICE()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
@ -41,7 +41,7 @@ void TCPSOCKET_OPEN_TWICE()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->open(NetworkInterface::get_default_instance()));
|
||||
|
||||
delete sock;
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tcp_stats[j].state);
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace {
|
|||
Timer tc_bucket; // Timer to limit a test cases run time
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
mbed_stats_socket_t tls_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
#endif
|
||||
|
||||
|
@ -154,7 +154,7 @@ int split2half_rmng_tls_test_time()
|
|||
return (tls_global::TESTS_TIMEOUT - tc_bucket.read()) / 2;
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int fetch_stats()
|
||||
{
|
||||
return SocketStats::mbed_stats_socket_get_each(&tls_stats[0], MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT);
|
||||
|
|
|
@ -28,7 +28,7 @@ void fill_tx_buffer_ascii(char *buff, size_t len);
|
|||
nsapi_error_t tlssocket_connect_to_echo_srv(TLSSocket &sock);
|
||||
nsapi_error_t tlssocket_connect_to_discard_srv(TLSSocket &sock);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
extern mbed_stats_socket_t tls_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
int fetch_stats(void);
|
||||
#endif
|
||||
|
|
|
@ -131,7 +131,7 @@ void tlssocket_echotest_nonblock_receive()
|
|||
|
||||
void TLSSOCKET_ECHOTEST_NONBLOCK()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int j = 0;
|
||||
int count = fetch_stats();
|
||||
for (; j < count; j++) {
|
||||
|
@ -184,7 +184,7 @@ void TLSSOCKET_ECHOTEST_NONBLOCK()
|
|||
}
|
||||
bytes2send -= sent;
|
||||
}
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (j = 0; j < count; j++) {
|
||||
if ((tls_stats[j].state == SOCK_OPEN) && (tls_stats[j].proto == NSAPI_TLS)) {
|
||||
|
|
|
@ -28,7 +28,7 @@ using namespace utest::v1;
|
|||
|
||||
void TLSSOCKET_OPEN_DESTRUCT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tls_stats[j].state);
|
||||
|
@ -43,7 +43,7 @@ void TLSSOCKET_OPEN_DESTRUCT()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
delete sock;
|
||||
}
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tls_stats[j].state);
|
||||
|
|
|
@ -72,7 +72,7 @@ void TLSSOCKET_OPEN_LIMIT()
|
|||
break;
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
int open_count = 0;
|
||||
for (int j = 0; j < count; j++) {
|
||||
|
|
|
@ -28,7 +28,7 @@ using namespace utest::v1;
|
|||
|
||||
void TLSSOCKET_OPEN_TWICE()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tls_stats[j].state);
|
||||
|
@ -43,7 +43,7 @@ void TLSSOCKET_OPEN_TWICE()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->open(NetworkInterface::get_default_instance()));
|
||||
|
||||
delete sock;
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, tls_stats[j].state);
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace {
|
|||
Timer tc_bucket; // Timer to limit a test cases run time
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
#endif
|
||||
|
||||
|
@ -89,7 +89,7 @@ int split2half_rmng_udp_test_time()
|
|||
return (udp_global::TESTS_TIMEOUT - tc_bucket.read()) / 2;
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int fetch_stats()
|
||||
{
|
||||
return SocketStats::mbed_stats_socket_get_each(&udp_stats[0], MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT);
|
||||
|
|
|
@ -23,7 +23,7 @@ void drop_bad_packets(UDPSocket &sock, int orig_timeout);
|
|||
nsapi_version_t get_ip_version();
|
||||
void fill_tx_buffer_ascii(char *buff, size_t len);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
int fetch_stats(void);
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_ADDRESS()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -48,7 +48,7 @@ void UDPSOCKET_BIND_ADDRESS()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_ADDRESS_INVALID()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -56,7 +56,7 @@ void UDPSOCKET_BIND_ADDRESS_INVALID()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_ADDRESS_NULL()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -47,7 +47,7 @@ void UDPSOCKET_BIND_ADDRESS_NULL()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_ADDRESS_PORT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -47,7 +47,7 @@ void UDPSOCKET_BIND_ADDRESS_PORT()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_PORT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -47,7 +47,7 @@ void UDPSOCKET_BIND_PORT()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_PORT_FAIL()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -57,7 +57,7 @@ void UDPSOCKET_BIND_PORT_FAIL()
|
|||
delete sock;
|
||||
delete sock2;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_UNOPENED()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -46,7 +46,7 @@ void UDPSOCKET_BIND_UNOPENED()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_BIND_WRONG_TYPE()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -56,7 +56,7 @@ void UDPSOCKET_BIND_WRONG_TYPE()
|
|||
|
||||
delete sock;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -133,7 +133,7 @@ void udpsocket_echotest_nonblock_receiver(void *receive_bytes)
|
|||
|
||||
void UDPSOCKET_ECHOTEST_NONBLOCK()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int j = 0;
|
||||
int count = fetch_stats();
|
||||
for (; j < count; j++) {
|
||||
|
@ -204,7 +204,7 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
printf("Packets sent: %d, packets received %d, loss ratio %.2lf\r\n", packets_sent, packets_recv, loss_ratio);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (j = 0; j < count; j++) {
|
||||
if ((NSAPI_UDP == udp_stats[j].proto) && (SOCK_OPEN == udp_stats[j].state)) {
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_OPEN_CLOSE_REPEAT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -42,7 +42,7 @@ void UDPSOCKET_OPEN_CLOSE_REPEAT()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->close());
|
||||
}
|
||||
delete sock;
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_OPEN_DESTRUCT()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -41,7 +41,7 @@ void UDPSOCKET_OPEN_DESTRUCT()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
delete sock;
|
||||
}
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -70,7 +70,7 @@ void UDPSOCKET_OPEN_LIMIT()
|
|||
if (!socket_list_head) {
|
||||
break;
|
||||
}
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
int open_count = 0;
|
||||
for (int j = 0; j < count; j++) {
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace utest::v1;
|
|||
|
||||
void UDPSOCKET_OPEN_TWICE()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
@ -41,7 +41,7 @@ void UDPSOCKET_OPEN_TWICE()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_PARAMETER, sock->open(NetworkInterface::get_default_instance()));
|
||||
|
||||
delete sock;
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (int j = 0; j < count; j++) {
|
||||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
|
|
|
@ -50,7 +50,7 @@ static void _ifdown()
|
|||
printf("MBED: ifdown\n");
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int fetch_stats()
|
||||
{
|
||||
return SocketStats::mbed_stats_socket_get_each(&udp_stats[0], MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT);
|
||||
|
|
|
@ -40,7 +40,7 @@ NetworkInterface *net;
|
|||
char interface_name[MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM][INTERFACE_NAME_LEN];
|
||||
int interface_num = 0;
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
#endif
|
||||
|
||||
|
@ -120,7 +120,7 @@ void fill_tx_buffer_ascii(char *buff, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int fetch_stats()
|
||||
{
|
||||
return SocketStats::mbed_stats_socket_get_each(&udp_stats[0], MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT);
|
||||
|
|
|
@ -57,7 +57,7 @@ NetworkInterface *get_interface();
|
|||
void drop_bad_packets(UDPSocket &sock, int orig_timeout);
|
||||
void fill_tx_buffer_ascii(char *buff, size_t len);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
int fetch_stats(void);
|
||||
#endif
|
||||
|
|
|
@ -120,7 +120,7 @@ void udpsocket_echotest_nonblock_receiver(void *receive_bytes)
|
|||
|
||||
void MULTIHOMING_UDPSOCKET_ECHOTEST_NONBLOCK()
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int j = 0;
|
||||
int count = fetch_stats();
|
||||
for (; j < count; j++) {
|
||||
|
@ -189,7 +189,7 @@ void MULTIHOMING_UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
printf("Interface %s, Packets sent: %d, packets received %d, loss ratio %.2lf\r\n", interface_name[j], packets_sent, packets_recv, loss_ratio);
|
||||
TEST_ASSERT_DOUBLE_WITHIN(TOLERATED_LOSS_RATIO, EXPECTED_LOSS_RATIO, loss_ratio);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
count = fetch_stats();
|
||||
for (j = 0; j < count; j++) {
|
||||
if ((NSAPI_UDP == udp_stats[j].proto) && (SOCK_OPEN == udp_stats[j].state)) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "SocketStats.h"
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
int SocketStats::get_entry_position(const Socket *const reference_id)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
SingletonPtr<PlatformMutex> SocketStats::_mutex;
|
||||
mbed_stats_socket_t SocketStats::_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
uint32_t SocketStats::_size = 0;
|
||||
|
@ -44,7 +44,7 @@ size_t SocketStats::mbed_stats_socket_get_each(mbed_stats_socket_t *stats, size_
|
|||
{
|
||||
MBED_ASSERT(stats != NULL);
|
||||
size_t i = 0;
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
memset(stats, 0, count * sizeof(mbed_stats_socket_t));
|
||||
_mutex->lock();
|
||||
for (uint32_t j = 0; j < count; j++) {
|
||||
|
@ -64,7 +64,7 @@ SocketStats::SocketStats()
|
|||
|
||||
void SocketStats::stats_new_socket_entry(const Socket *const reference_id)
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
_mutex->lock();
|
||||
if (get_entry_position(reference_id) >= 0) {
|
||||
// Duplicate entry
|
||||
|
@ -98,7 +98,7 @@ void SocketStats::stats_new_socket_entry(const Socket *const reference_id)
|
|||
|
||||
void SocketStats::stats_update_socket_state(const Socket *const reference_id, socket_state state)
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
_mutex->lock();
|
||||
int position = get_entry_position(reference_id);
|
||||
if (position >= 0) {
|
||||
|
@ -113,7 +113,7 @@ void SocketStats::stats_update_socket_state(const Socket *const reference_id, so
|
|||
|
||||
void SocketStats::stats_update_peer(const Socket *const reference_id, const SocketAddress &peer)
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
_mutex->lock();
|
||||
int position = get_entry_position(reference_id);
|
||||
if ((position >= 0) && (!_stats[position].peer)) {
|
||||
|
@ -125,7 +125,7 @@ void SocketStats::stats_update_peer(const Socket *const reference_id, const Sock
|
|||
|
||||
void SocketStats::stats_update_proto(const Socket *const reference_id, nsapi_protocol_t proto)
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
_mutex->lock();
|
||||
int position = get_entry_position(reference_id);
|
||||
if (position >= 0) {
|
||||
|
@ -137,7 +137,7 @@ void SocketStats::stats_update_proto(const Socket *const reference_id, nsapi_pro
|
|||
|
||||
void SocketStats::stats_update_sent_bytes(const Socket *const reference_id, size_t sent_bytes)
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
_mutex->lock();
|
||||
int position = get_entry_position(reference_id);
|
||||
if ((position >= 0) && ((int32_t)sent_bytes > 0)) {
|
||||
|
@ -149,7 +149,7 @@ void SocketStats::stats_update_sent_bytes(const Socket *const reference_id, size
|
|||
|
||||
void SocketStats::stats_update_recv_bytes(const Socket *const reference_id, size_t recv_bytes)
|
||||
{
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
_mutex->lock();
|
||||
int position = get_entry_position(reference_id);
|
||||
if ((position >= 0) && ((int32_t)recv_bytes > 0)) {
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
*/
|
||||
void stats_update_recv_bytes(const Socket *const reference_id, size_t recv_bytes);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||
private:
|
||||
static mbed_stats_socket_t _stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
static SingletonPtr<PlatformMutex> _mutex;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
"help": "Number of cached host name resolutions",
|
||||
"value": 3
|
||||
},
|
||||
"socket-stats-enable": {
|
||||
"socket-stats-enabled": {
|
||||
"help": "Enable network socket statistics",
|
||||
"value": false
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue