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 #include "mbed_trace.h"
23 
24 #define TRACE_GROUP "GRNT"
25 
26 NetworkInterface *get_interface();
27 void drop_bad_packets(UDPSocket &sock, int orig_timeout);
28 nsapi_version_t get_ip_version();
29 bool check_oversized_packets(nsapi_error_t error, int &size);
30 void fill_tx_buffer_ascii(char *buff, size_t len);
31 
32 #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
33 extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
34 int fetch_stats(void);
35 #endif
36 
37 /**
38  * Single testcase might take only half of the remaining execution time
39  */
40 int split2half_rmng_udp_test_time(); // [s]
41 
42 namespace udp_global {
43 #ifdef MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S
44 static const int TESTS_TIMEOUT = MBED_GREENTEA_TEST_UDPSOCKET_TIMEOUT_S;
45 #else
46 static const int TESTS_TIMEOUT = (20 * 60);
47 #endif
48 
49 static const int MAX_SEND_SIZE_IPV4 = 536;
50 static const int MAX_SEND_SIZE_IPV6 = 1220;
51 }
52 
53 /*
54  * Test cases
55  */
56 void UDPSOCKET_ECHOTEST();
57 void UDPSOCKET_ECHOTEST_NONBLOCK();
58 void UDPSOCKET_ECHOTEST_BURST();
59 void UDPSOCKET_ECHOTEST_BURST_NONBLOCK();
60 void UDPSOCKET_OPEN_CLOSE_REPEAT();
61 void UDPSOCKET_OPEN_DESTRUCT();
62 void UDPSOCKET_OPEN_LIMIT();
63 void UDPSOCKET_OPEN_TWICE();
64 void UDPSOCKET_BIND_PORT();
65 void UDPSOCKET_BIND_PORT_FAIL();
66 void UDPSOCKET_BIND_ADDRESS_PORT();
67 void UDPSOCKET_BIND_ADDRESS_NULL();
68 void UDPSOCKET_BIND_ADDRESS_INVALID();
69 void UDPSOCKET_BIND_ADDRESS();
70 void UDPSOCKET_BIND_WRONG_TYPE();
71 void UDPSOCKET_BIND_UNOPENED();
72 void UDPSOCKET_RECV_TIMEOUT();
73 void UDPSOCKET_SENDTO_INVALID();
74 void UDPSOCKET_SENDTO_REPEAT();
75 void UDPSOCKET_SENDTO_TIMEOUT();
76 
77 #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:33
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.