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 
21 #ifndef MULTIHOMING_TESTS_H
22 #define MULTIHOMING_TESTS_H
23 
24 #define DNS_TEST_HOST_LEN 40
25 #define INTERFACE_NAME_LEN 6
26 
27 #ifndef MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM
28 #define MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM 2
29 #endif
30 
31 #ifndef MBED_CONF_APP_DNS_TEST_HOSTS_NUM
32 #define MBED_CONF_APP_DNS_TEST_HOSTS_NUM 12
33 #endif
34 
35 // Hostnames for testing against
36 // Both lists must have A and AAAA records
37 #ifndef MBED_CONF_APP_DNS_TEST_HOSTS
38 #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"}
39 #endif
40 
41 
42 #define ETH_INTERFACE 0
43 #define WIFI_INTERFACE 1
44 
45 
46 struct dns_application_data {
47  rtos::Semaphore *semaphore;
48  nsapi_error_t result;
49  SocketAddress addr;
50  nsapi_error_t req_result;
51  bool value_set;
52 };
53 
54 
55 extern char interface_name[MBED_CONF_MULTIHOMING_MAX_INTERFACES_NUM][INTERFACE_NAME_LEN];
56 extern int interface_num;
57 
58 const char dns_test_hosts[MBED_CONF_APP_DNS_TEST_HOSTS_NUM][DNS_TEST_HOST_LEN] = MBED_CONF_APP_DNS_TEST_HOSTS;
59 
60 
61 NetworkInterface *get_interface(int interface_index);
62 void drop_bad_packets(UDPSocket &sock, int orig_timeout);
63 void fill_tx_buffer_ascii(char *buff, size_t len);
64 
65 #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
66 extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
67 int fetch_stats(void);
68 #endif
69 
70 /*
71  * Test cases
72  */
73 void MULTIHOMING_SYNCHRONOUS_DNS();
74 void MULTIHOMING_ASYNCHRONOUS_DNS();
75 void MULTIHOMING_UDPSOCKET_ECHOTEST();
76 void MULTIHOMING_UDPSOCKET_ECHOTEST_NONBLOCK();
77 
78 #endif //UDP_TESTS_H
The Semaphore class is used to manage and protect access to a set of shared resources.
Definition: Semaphore.h:47
UDP socket implementation.
Definition: UDPSocket.h:33
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:95
SocketAddress class.
Definition: SocketAddress.h:35
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.