From 0f858410fb5073d3dbd56ce2b5528bdb66639f40 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Wed, 28 Feb 2018 16:05:50 +0200 Subject: [PATCH] Added mac_neighbor_table stub's --- .../unittest/stub/mac_neighbor_table_stub.c | 88 +++++++++++++++++++ .../unittest/stub/mac_neighbor_table_stub.h | 34 +++++++ 2 files changed, 122 insertions(+) create mode 100644 test/nanostack/unittest/stub/mac_neighbor_table_stub.c create mode 100644 test/nanostack/unittest/stub/mac_neighbor_table_stub.h diff --git a/test/nanostack/unittest/stub/mac_neighbor_table_stub.c b/test/nanostack/unittest/stub/mac_neighbor_table_stub.c new file mode 100644 index 00000000000..06e9baa0efd --- /dev/null +++ b/test/nanostack/unittest/stub/mac_neighbor_table_stub.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2018, Arm Limited and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nsconfig.h" +#include "string.h" +#include "ns_types.h" +#include "ns_trace.h" +#include "common_functions.h" +#include "nsdynmemLIB.h" +#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h" + +#include "mac_neighbor_table_stub.h" + +mac_neighbor_table_stub_def mac_neighbor_table_stub; + +mac_neighbor_table__t *mac_neighbor_table_create(uint8_t table_size, neighbor_entry_remove_notify *remove_cb, neighbor_entry_nud_notify *nud_cb, void *user_indentifier, uint32_t nud_threshold) +{ + return mac_neighbor_table_stub.test_class; +} + +void neighbor_table_neighbor_table_class_delete(mac_neighbor_table_t *table_class) +{ + +} + + +void neighbor_table_class_neighbor_list_clean(mac_neighbor_table_t *table_class) +{ + +} + + +void neighbor_table_class_neighbor_timeout_update(mac_neighbor_table_t *table_class, uint32_t time_update) +{ + +} + + +mac_neighbor_table_entry_t *neighbor_table_class_entry_allocate(mac_neighbor_table_t *table_class, const uint8_t *mac64) +{ + return mac_neighbor_table_stub.test_neigh; +} + +void neighbor_table_class_neighbor_remove(mac_neighbor_table_t *table_class, mac_neighbor_table_entry_t *neighbor_entry) +{ + +} + + +void neighbor_table_class_neighbor_refresh(mac_neighbor_table_t *table_class, mac_neighbor_table_entry_t *neighbor_entry, uint32_t life_time) +{ + +} + +void neighbor_table_class_neighbor_connected(mac_neighbor_table_t *table_class, mac_neighbor_table_entry_t *neighbor_entry) +{ + +} + +void mac_neighbor_table_trusted_neighbor(mac_neighbor_table_t *table_class, mac_neighbor_table_entry_t *neighbor_entry, bool trusted_device) +{ + +} + + +mac_neighbor_table_entry_t *neighbor_table_class_address_discover(mac_neighbor_table_t *table_class, const uint8_t *address, uint8_t address_type) +{ + return mac_neighbor_table_stub.test_neigh; +} + +mac_neighbor_table_entry_t *neighbor_table_class_attribute_discover(mac_neighbor_table_t *table_class, uint8_t index) +{ + return mac_neighbor_table_stub.test_neigh; +} diff --git a/test/nanostack/unittest/stub/mac_neighbor_table_stub.h b/test/nanostack/unittest/stub/mac_neighbor_table_stub.h new file mode 100644 index 00000000000..53af8d70fe2 --- /dev/null +++ b/test/nanostack/unittest/stub/mac_neighbor_table_stub.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018, Arm Limited and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NEIGHBOR_TABLE_CLASS_STUB_H_ +#define NEIGHBOR_TABLE_CLASS_STUB_H_ + +#include "inttypes.h" +#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h" + +typedef struct { + mac_neighbor_table_t *test_class; + mac_neighbor_table_entry_t *test_neigh; +} mac_neighbor_table_stub_def; + +extern mac_neighbor_table_stub_def mac_neighbor_table_stub; + + + + +#endif /* NEIGHBOR_TABLE_CLASS_STUB_H_ */