Mistake on this page?
Report an issue in GitHub or email us
tcp_tests.h
1 /*
2  * Copyright (c) 2018, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef TCP_TESTS_H
19 #define TCP_TESTS_H
20 
21 #include "../test_params.h"
22 #include "mbed_trace.h"
23 
24 #define TRACE_GROUP "GRNT"
25 
26 NetworkInterface *get_interface();
27 void drop_bad_packets(TCPSocket &sock, int orig_timeout);
28 nsapi_version_t get_ip_version();
29 void fill_tx_buffer_ascii(char *buff, size_t len);
30 nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket &sock);
31 nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock);
32 bool is_tcp_supported();
33 
34 #define SKIP_IF_TCP_UNSUPPORTED() \
35  if (!is_tcp_supported()) { \
36  TEST_SKIP_MESSAGE("TCP not supported"); \
37  }
38 
39 #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
40 extern mbed_stats_socket_t tcp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
41 int fetch_stats(void);
42 #endif
43 
44 /**
45  * Single testcase might take only half of the remaining execution time
46  */
47 int split2half_rmng_tcp_test_time(); // [s]
48 
49 namespace tcp_global {
50 #ifdef MBED_GREENTEA_TEST_TCPSOCKET_TIMEOUT_S
51 static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_TCPSOCKET_TIMEOUT_S;
52 #else
53 #define MESH 3
54 #define WISUN 0x2345
55 #if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == MESH && MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == WISUN
56 static const int TESTS_TIMEOUT = (25 * 60);
57 #else
58 static const int TESTS_TIMEOUT = (10 * 60);
59 #endif
60 #endif
61 
62 static const int TCP_OS_STACK_SIZE = 2048;
63 
64 static const int RX_BUFF_SIZE = 1220;
65 static const int TX_BUFF_SIZE = 1220;
66 
67 extern char rx_buffer[RX_BUFF_SIZE];
68 extern char tx_buffer[TX_BUFF_SIZE];
69 }
70 
71 /*
72  * Test cases
73  */
74 void TCPSOCKET_CONNECT_INVALID();
75 void TCPSOCKET_ECHOTEST();
76 void TCPSOCKET_ECHOTEST_NONBLOCK();
77 void TCPSOCKET_ECHOTEST_BURST();
78 void TCPSOCKET_ECHOTEST_BURST_NONBLOCK();
79 void TCPSOCKET_ENDPOINT_CLOSE();
80 void TCPSOCKET_OPEN_DESTRUCT();
81 void TCPSOCKET_OPEN_CLOSE_REPEAT();
82 void TCPSOCKET_OPEN_LIMIT();
83 void TCPSOCKET_OPEN_TWICE();
84 void TCPSOCKET_BIND_PORT();
85 void TCPSOCKET_BIND_PORT_FAIL();
86 void TCPSOCKET_BIND_ADDRESS_PORT();
87 void TCPSOCKET_BIND_ADDRESS_NULL();
88 void TCPSOCKET_BIND_ADDRESS_INVALID();
89 void TCPSOCKET_BIND_ADDRESS();
90 void TCPSOCKET_BIND_WRONG_TYPE();
91 void TCPSOCKET_BIND_UNOPENED();
92 void TCPSOCKET_RECV_100K();
93 void TCPSOCKET_RECV_100K_NONBLOCK();
94 void TCPSOCKET_RECV_TIMEOUT();
95 void TCPSOCKET_SEND_REPEAT();
96 void TCPSOCKET_SEND_TIMEOUT();
97 void TCPSOCKET_THREAD_PER_SOCKET_SAFETY();
98 void TCPSOCKET_SETSOCKOPT_KEEPALIVE_VALID();
99 
100 #endif //TCP_TESTS_H
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:95
TCP socket connection.
Definition: TCPSocket.h:32
Common interface that is shared between network devices.
Structure to parse socket statistics.
Definition: SocketStats.h:45
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.