2 This file is part of GNUnet.
3 Copyright (C) 2010-2015 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
21 * @file ats/test_ats_api.c
23 * @author Christian Grothoff
26 #include "test_ats_lib.h"
29 * Global timeout for the testcase.
31 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
34 * Definition of the test as a sequence of commands.
36 static struct Command test_commands[] = {
38 .code = CMD_ADD_ADDRESS,
39 .label = "add-address-0-0",
40 .details.add_address = {
43 .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
46 .scope = GNUNET_NT_LAN
54 /* 1: adding same address again should fail */
56 .code = CMD_ADD_ADDRESS,
57 .label = "add-address-0-0:FAIL",
58 .details.add_address = {
61 .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
64 .scope = GNUNET_NT_LAN
71 /* 2: some solver still require explicit start */
73 .code = CMD_REQUEST_CONNECTION_START,
75 .details.request_connection_start = {
81 /* 3: check we got an address */
83 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
84 .details.await_address_suggestion = {
85 .add_label = "add-address-0-0"
90 /* 4: check monitor also got the address */
92 .code = CMD_AWAIT_ADDRESS_INFORMATION,
93 .details.await_address_information = {
94 .add_label = "add-address-0-0"
99 /* 5: test session API */
101 .code = CMD_ADD_SESSION,
102 .label = "add-session-0-0-1",
103 .details.add_session = {
104 .add_label = "add-address-0-0",
111 .code = CMD_DEL_SESSION,
112 .details.del_session = {
113 .add_session_label = "add-session-0-0-1",
118 /* 7: test preference API */
120 .code = CMD_CHANGE_PREFERENCE,
121 .details.change_preference = {
123 /* FIXME: preference details */
129 .code = CMD_PROVIDE_FEEDBACK,
130 .details.provide_feedback = {
133 /* FIXME: preference details */
138 /* 9: test sanity check address listing */
140 .code = CMD_LIST_ADDRESSES,
141 .details.list_addresses = {
146 .min_active_calls = 1,
147 .max_active_calls = 1
152 /* 10: remove address testing */
154 .code = CMD_DEL_ADDRESS,
155 .details.del_address = {
156 .add_label = "add-address-0-0"
161 /* 11: check we got disconnected */
163 .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
164 .details.await_disconnect_suggestion = {
170 /* 12: just for symmetry, also stop asking for the connection */
172 .code = CMD_REQUEST_CONNECTION_STOP,
173 .details.request_connection_stop = {
174 .connect_label = "request-0",
179 /* 13: add address again */
181 .code = CMD_ADD_ADDRESS,
182 .label = "add-address-0-0:1",
183 .details.add_address = {
188 .scope = GNUNET_NT_LAN
196 /* 14: some solver still require explicit start */
198 .code = CMD_REQUEST_CONNECTION_START,
199 .label = "request-0",
200 .details.request_connection_start = {
206 /* 15: check we got an address */
208 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
209 .details.await_address_suggestion = {
210 .add_label = "add-address-0-0:1"
215 /* 16: add alternative address */
217 .code = CMD_ADD_ADDRESS,
218 .label = "add-address-0-1",
219 .details.add_address = {
222 .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
225 .scope = GNUNET_NT_LAN
233 /* 17: remove original address */
235 .code = CMD_DEL_ADDRESS,
236 .details.del_address = {
237 .add_label = "add-address-0-0:1"
242 /* 18: check we switched to alternative address */
244 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
245 .details.await_address_suggestion = {
246 .add_label = "add-address-0-1"
251 /* 19: remove alternative address */
253 .code = CMD_DEL_ADDRESS,
254 .details.del_address = {
255 .add_label = "add-address-0-1"
260 /* 20: check we got disconnected */
262 .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
263 .details.await_disconnect_suggestion = {
269 /* 21: just for symmetry, also stop asking for the connection */
271 .code = CMD_REQUEST_CONNECTION_STOP,
272 .details.request_connection_stop = {
273 .connect_label = "request-0",
278 /* Test ends successfully */
289 return TEST_ATS_run (argc,
296 /* end of file test_ats_api.c */