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