takashi kadono
/
Nucleo446_SSD1331
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/TESTS/netsocket/dns/dns_tests.h@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2018, ARM Limited, All Rights Reserved |
kadonotakashi | 0:8fdf9a60065b | 3 | * SPDX-License-Identifier: Apache-2.0 |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
kadonotakashi | 0:8fdf9a60065b | 6 | * not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 7 | * You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 8 | * |
kadonotakashi | 0:8fdf9a60065b | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
kadonotakashi | 0:8fdf9a60065b | 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 14 | * See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 15 | * limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 16 | */ |
kadonotakashi | 0:8fdf9a60065b | 17 | |
kadonotakashi | 0:8fdf9a60065b | 18 | #ifndef DNS_TESTS_H |
kadonotakashi | 0:8fdf9a60065b | 19 | #define DNS_TESTS_H |
kadonotakashi | 0:8fdf9a60065b | 20 | |
kadonotakashi | 0:8fdf9a60065b | 21 | #ifndef MBED_CONF_APP_DNS_SIMULT_QUERIES |
kadonotakashi | 0:8fdf9a60065b | 22 | #define MBED_CONF_APP_DNS_SIMULT_QUERIES 5 |
kadonotakashi | 0:8fdf9a60065b | 23 | #endif |
kadonotakashi | 0:8fdf9a60065b | 24 | |
kadonotakashi | 0:8fdf9a60065b | 25 | #ifndef MBED_CONF_NSAPI_DNS_CACHE_SIZE |
kadonotakashi | 0:8fdf9a60065b | 26 | #define MBED_CONF_NSAPI_DNS_CACHE_SIZE 3 |
kadonotakashi | 0:8fdf9a60065b | 27 | #endif |
kadonotakashi | 0:8fdf9a60065b | 28 | |
kadonotakashi | 0:8fdf9a60065b | 29 | // Hostnames for testing against |
kadonotakashi | 0:8fdf9a60065b | 30 | // Both lists must have A and AAAA records |
kadonotakashi | 0:8fdf9a60065b | 31 | #ifndef MBED_CONF_APP_DNS_TEST_HOSTS |
kadonotakashi | 0:8fdf9a60065b | 32 | #define MBED_CONF_APP_DNS_TEST_HOSTS {"google.com", "youtube.com", "facebook.com", "wikipedia.org", "yahoo.com", "instagram.com"} |
kadonotakashi | 0:8fdf9a60065b | 33 | #endif |
kadonotakashi | 0:8fdf9a60065b | 34 | |
kadonotakashi | 0:8fdf9a60065b | 35 | #ifndef MBED_CONF_APP_DNS_TEST_HOSTS_SECOND |
kadonotakashi | 0:8fdf9a60065b | 36 | #define MBED_CONF_APP_DNS_TEST_HOSTS_SECOND {"ipv6ready.org", "wireshark.org", "bbc.co.uk", "cnn.com", "www.flickr.com", "www.mozilla.org"} |
kadonotakashi | 0:8fdf9a60065b | 37 | #endif |
kadonotakashi | 0:8fdf9a60065b | 38 | |
kadonotakashi | 0:8fdf9a60065b | 39 | #ifndef MBED_CONF_APP_DNS_TEST_HOSTS_NUM |
kadonotakashi | 0:8fdf9a60065b | 40 | #define MBED_CONF_APP_DNS_TEST_HOSTS_NUM 6 |
kadonotakashi | 0:8fdf9a60065b | 41 | #endif |
kadonotakashi | 0:8fdf9a60065b | 42 | |
kadonotakashi | 0:8fdf9a60065b | 43 | #define DNS_TEST_HOST_LEN 40 |
kadonotakashi | 0:8fdf9a60065b | 44 | |
kadonotakashi | 0:8fdf9a60065b | 45 | struct dns_application_data { |
kadonotakashi | 0:8fdf9a60065b | 46 | rtos::Semaphore *semaphore; |
kadonotakashi | 0:8fdf9a60065b | 47 | nsapi_error_t result; |
kadonotakashi | 0:8fdf9a60065b | 48 | SocketAddress addr; |
kadonotakashi | 0:8fdf9a60065b | 49 | nsapi_error_t req_result; |
kadonotakashi | 0:8fdf9a60065b | 50 | bool value_set; |
kadonotakashi | 0:8fdf9a60065b | 51 | }; |
kadonotakashi | 0:8fdf9a60065b | 52 | |
kadonotakashi | 0:8fdf9a60065b | 53 | extern const char dns_test_hosts[MBED_CONF_APP_DNS_TEST_HOSTS_NUM][DNS_TEST_HOST_LEN]; |
kadonotakashi | 0:8fdf9a60065b | 54 | extern const char dns_test_hosts_second[MBED_CONF_APP_DNS_TEST_HOSTS_NUM][DNS_TEST_HOST_LEN]; |
kadonotakashi | 0:8fdf9a60065b | 55 | |
kadonotakashi | 0:8fdf9a60065b | 56 | /* |
kadonotakashi | 0:8fdf9a60065b | 57 | * Utility functions |
kadonotakashi | 0:8fdf9a60065b | 58 | */ |
kadonotakashi | 0:8fdf9a60065b | 59 | NetworkInterface *get_interface(); |
kadonotakashi | 0:8fdf9a60065b | 60 | void hostbyname_cb(void *data, nsapi_error_t result, SocketAddress *address); |
kadonotakashi | 0:8fdf9a60065b | 61 | void do_asynchronous_gethostbyname(const char hosts[][DNS_TEST_HOST_LEN], unsigned int op_count, int *exp_ok, int *exp_no_mem, int *exp_dns_failure, int *exp_timeout); |
kadonotakashi | 0:8fdf9a60065b | 62 | void do_gethostbyname(const char hosts[][DNS_TEST_HOST_LEN], unsigned int op_count, int *exp_ok, int *exp_no_mem, int *exp_dns_failure, int *exp_timeout); |
kadonotakashi | 0:8fdf9a60065b | 63 | |
kadonotakashi | 0:8fdf9a60065b | 64 | /* |
kadonotakashi | 0:8fdf9a60065b | 65 | * Test cases |
kadonotakashi | 0:8fdf9a60065b | 66 | */ |
kadonotakashi | 0:8fdf9a60065b | 67 | void ASYNCHRONOUS_DNS(); |
kadonotakashi | 0:8fdf9a60065b | 68 | void ASYNCHRONOUS_DNS_SIMULTANEOUS(); |
kadonotakashi | 0:8fdf9a60065b | 69 | void ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE(); |
kadonotakashi | 0:8fdf9a60065b | 70 | void ASYNCHRONOUS_DNS_CACHE(); |
kadonotakashi | 0:8fdf9a60065b | 71 | void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC(); |
kadonotakashi | 0:8fdf9a60065b | 72 | void ASYNCHRONOUS_DNS_CANCEL(); |
kadonotakashi | 0:8fdf9a60065b | 73 | void ASYNCHRONOUS_DNS_EXTERNAL_EVENT_QUEUE(); |
kadonotakashi | 0:8fdf9a60065b | 74 | void ASYNCHRONOUS_DNS_INVALID_HOST(); |
kadonotakashi | 0:8fdf9a60065b | 75 | void ASYNCHRONOUS_DNS_TIMEOUTS(); |
kadonotakashi | 0:8fdf9a60065b | 76 | void ASYNCHRONOUS_DNS_SIMULTANEOUS_REPEAT(); |
kadonotakashi | 0:8fdf9a60065b | 77 | void SYNCHRONOUS_DNS(); |
kadonotakashi | 0:8fdf9a60065b | 78 | void SYNCHRONOUS_DNS_MULTIPLE(); |
kadonotakashi | 0:8fdf9a60065b | 79 | void SYNCHRONOUS_DNS_CACHE(); |
kadonotakashi | 0:8fdf9a60065b | 80 | void SYNCHRONOUS_DNS_INVALID(); |
kadonotakashi | 0:8fdf9a60065b | 81 | #endif |