Mistake on this page?
Report an issue in GitHub or email us
udp_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 UDP_TESTS_H
19 #define UDP_TESTS_H
20 
21 #include "../test_params.h"
22 
23 NetworkInterface *get_interface();
24 void drop_bad_packets(UDPSocket &sock, int orig_timeout);
25 nsapi_version_t get_ip_version();
26 bool check_oversized_packets(nsapi_error_t error, int &size);
27 void fill_tx_buffer_ascii(char *buff, size_t len);
28 
29 #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
30 extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
31 int fetch_stats(void);
32 #endif
33 
34 /**
35  * Single testcase might take only half of the remaining execution time
36  */
37 int split2half_rmng_udp_test_time(); // [s]
38 
39 namespace udp_global {
40 #ifdef MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S
41 static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S;
42 #else
43 static const int TESTS_TIMEOUT = 480;
44 #endif
45 
46 static const int MAX_SEND_SIZE_IPV4 = 536;
47 static const int MAX_SEND_SIZE_IPV6 = 1220;
48 }
49 
50 /*
51  * Test cases
52  */
53 void UDPSOCKET_ECHOTEST();
54 void UDPSOCKET_ECHOTEST_NONBLOCK();
55 void UDPSOCKET_ECHOTEST_BURST();
56 void UDPSOCKET_ECHOTEST_BURST_NONBLOCK();
57 void UDPSOCKET_OPEN_CLOSE_REPEAT();
58 void UDPSOCKET_OPEN_DESTRUCT();
59 void UDPSOCKET_OPEN_LIMIT();
60 void UDPSOCKET_OPEN_TWICE();
61 void UDPSOCKET_BIND_PORT();
62 void UDPSOCKET_BIND_PORT_FAIL();
63 void UDPSOCKET_BIND_ADDRESS_PORT();
64 void UDPSOCKET_BIND_ADDRESS_NULL();
65 void UDPSOCKET_BIND_ADDRESS_INVALID();
66 void UDPSOCKET_BIND_ADDRESS();
67 void UDPSOCKET_BIND_WRONG_TYPE();
68 void UDPSOCKET_BIND_UNOPENED();
69 void UDPSOCKET_RECV_TIMEOUT();
70 void UDPSOCKET_SENDTO_INVALID();
71 void UDPSOCKET_SENDTO_REPEAT();
72 void UDPSOCKET_SENDTO_TIMEOUT();
73 
74 #endif //UDP_TESTS_H
MBED_NORETURN void error(const char *format,...) MBED_PRINTF(1
To generate a fatal compile-time error, you can use the pre-processor error directive.
UDP socket implementation.
Definition: UDPSocket.h:31
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:95
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.