Mistake on this page?
Report an issue in GitHub or email us
multihoming_tests.h
1 /*
2  * Copyright (c) 2019, 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 #include "mbed.h"
19 #include "nsapi_dns.h"
20 #include "mbed_trace.h"
21 
22 #define TRACE_GROUP "GRNT"
23 
24 #ifndef MULTIHOMING_TESTS_H
25 #define MULTIHOMING_TESTS_H
26 
27 #define DNS_TEST_HOST_LEN 40
28 #define INTERFACE_NAME_LEN 6
29 
30 #ifndef MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM
31 #define MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM 2
32 #endif
33 
34 #ifndef MBED_CONF_APP_DNS_TEST_HOSTS_NUM
35 #define MBED_CONF_APP_DNS_TEST_HOSTS_NUM 12
36 #endif
37 
38 // Hostnames for testing against
39 // Both lists must have A and AAAA records
40 #ifndef MBED_CONF_APP_DNS_TEST_HOSTS
41 #define MBED_CONF_APP_DNS_TEST_HOSTS {"google.com", "youtube.com", "facebook.com", "wikipedia.org", "yahoo.com", "instagram.com", "ipv6ready.org", "wireshark.org", "bbc.co.uk", "cnn.com", "www.flickr.com", "www.mozilla.org"}
42 #endif
43 
44 
45 #define ETH_INTERFACE 0
46 #define WIFI_INTERFACE 1
47 
48 
49 struct dns_application_data {
50  rtos::Semaphore *semaphore;
51  nsapi_error_t result;
52  SocketAddress addr;
53  nsapi_error_t req_result;
54  bool value_set;
55 };
56 
57 
58 extern char interface_name[MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM][INTERFACE_NAME_LEN];
59 extern int interface_num;
60 
61 const char dns_test_hosts[MBED_CONF_APP_DNS_TEST_HOSTS_NUM][DNS_TEST_HOST_LEN] = MBED_CONF_APP_DNS_TEST_HOSTS;
62 
63 
64 NetworkInterface *get_interface(int interface_index);
65 void drop_bad_packets(UDPSocket &sock, int orig_timeout);
66 void fill_tx_buffer_ascii(char *buff, size_t len);
67 
68 #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
69 extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
70 int fetch_stats(void);
71 #endif
72 
73 /*
74  * Test cases
75  */
76 void MULTIHOMING_SYNCHRONOUS_DNS();
77 void MULTIHOMING_ASYNCHRONOUS_DNS();
78 void MULTIHOMING_UDPSOCKET_ECHOTEST();
79 void MULTIHOMING_UDPSOCKET_ECHOTEST_NONBLOCK();
80 
81 #endif //UDP_TESTS_H
The Semaphore class is used to manage and protect access to a set of shared resources.
Definition: Semaphore.h:50
UDP socket implementation.
Definition: UDPSocket.h:34
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:142
SocketAddress class.
Definition: SocketAddress.h:37
Common interface that is shared between network devices.
Structure to parse socket statistics.
Definition: SocketStats.h:46
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.