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 
23 NetworkInterface *get_interface();
24 void drop_bad_packets(TCPSocket &sock, int orig_timeout);
25 nsapi_version_t get_ip_version();
26 void fill_tx_buffer_ascii(char *buff, size_t len);
27 nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket &sock);
28 nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock);
29 bool is_tcp_supported();
30 
31 #define SKIP_IF_TCP_UNSUPPORTED() \
32  if (!is_tcp_supported()) { \
33  TEST_SKIP_MESSAGE("TCP not supported"); \
34  }
35 
36 #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
37 extern mbed_stats_socket_t tcp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
38 int fetch_stats(void);
39 #endif
40 
41 /**
42  * Single testcase might take only half of the remaining execution time
43  */
44 int split2half_rmng_tcp_test_time(); // [s]
45 
46 namespace tcp_global {
47 #ifdef MBED_GREENTEA_TEST_TCPSOCKET_TIMEOUT_S
48 static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_TCPSOCKET_TIMEOUT_S;
49 #else
50 static const int TESTS_TIMEOUT = (10 * 60);
51 #endif
52 static const int TCP_OS_STACK_SIZE = 2048;
53 
54 static const int RX_BUFF_SIZE = 1220;
55 static const int TX_BUFF_SIZE = 1220;
56 
57 extern char rx_buffer[RX_BUFF_SIZE];
58 extern char tx_buffer[TX_BUFF_SIZE];
59 }
60 
61 /*
62  * Test cases
63  */
64 void TCPSOCKET_CONNECT_INVALID();
65 void TCPSOCKET_ECHOTEST();
66 void TCPSOCKET_ECHOTEST_NONBLOCK();
67 void TCPSOCKET_ECHOTEST_BURST();
68 void TCPSOCKET_ECHOTEST_BURST_NONBLOCK();
69 void TCPSOCKET_ENDPOINT_CLOSE();
70 void TCPSOCKET_OPEN_DESTRUCT();
71 void TCPSOCKET_OPEN_CLOSE_REPEAT();
72 void TCPSOCKET_OPEN_LIMIT();
73 void TCPSOCKET_OPEN_TWICE();
74 void TCPSOCKET_BIND_PORT();
75 void TCPSOCKET_BIND_PORT_FAIL();
76 void TCPSOCKET_BIND_ADDRESS_PORT();
77 void TCPSOCKET_BIND_ADDRESS_NULL();
78 void TCPSOCKET_BIND_ADDRESS_INVALID();
79 void TCPSOCKET_BIND_ADDRESS();
80 void TCPSOCKET_BIND_WRONG_TYPE();
81 void TCPSOCKET_BIND_UNOPENED();
82 void TCPSOCKET_RECV_100K();
83 void TCPSOCKET_RECV_100K_NONBLOCK();
84 void TCPSOCKET_RECV_TIMEOUT();
85 void TCPSOCKET_SEND_REPEAT();
86 void TCPSOCKET_SEND_TIMEOUT();
87 void TCPSOCKET_THREAD_PER_SOCKET_SAFETY();
88 void TCPSOCKET_SETSOCKOPT_KEEPALIVE_VALID();
89 
90 #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.