From 040c9af841466f240627c8ffbc6d13a591ccde18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Fri, 28 Jun 2019 13:43:10 +0200 Subject: [PATCH] Add stub ChiakiDiscoveryService --- lib/CMakeLists.txt | 6 ++-- lib/include/chiaki/discoveryservice.h | 40 +++++++++++++++++++++++++++ lib/src/discoveryservice.c | 28 +++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 lib/include/chiaki/discoveryservice.h create mode 100644 lib/src/discoveryservice.c diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 599c2d2..ad1c261 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -25,7 +25,8 @@ set(HEADER_FILES include/chiaki/discovery.h include/chiaki/congestioncontrol.h include/chiaki/stoppipe.h - include/chiaki/reorderqueue.h) + include/chiaki/reorderqueue.h + include/chiaki/discoveryservice.h) set(SOURCE_FILES src/common.c @@ -53,7 +54,8 @@ set(SOURCE_FILES src/discovery.c src/congestioncontrol.c src/stoppipe.c - src/reorderqueue.c) + src/reorderqueue.c + src/discoveryservice.c) add_subdirectory(protobuf) include_directories("${NANOPB_SOURCE_DIR}") diff --git a/lib/include/chiaki/discoveryservice.h b/lib/include/chiaki/discoveryservice.h new file mode 100644 index 0000000..6510c29 --- /dev/null +++ b/lib/include/chiaki/discoveryservice.h @@ -0,0 +1,40 @@ +/* + * This file is part of Chiaki. + * + * Chiaki is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Chiaki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chiaki. If not, see . + */ + + +#ifndef CHIAKI_DISCOVERYSERVICE_H +#define CHIAKI_DISCOVERYSERVICE_H + +#include "discovery.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct chiaki_discovery_service_t +{ + ChiakiDiscovery discovery; +} ChiakiDiscoveryService; + +CHIAKI_EXPORT ChiakiErrorCode chiaki_discovery_service_init(ChiakiDiscoveryService *service, ChiakiLog *log, sa_family_t family); +CHIAKI_EXPORT void chiaki_discovery_service_fini(ChiakiDiscoveryService *service); + +#ifdef __cplusplus +} +#endif + +#endif //CHIAKI_DISCOVERYSERVICE_H diff --git a/lib/src/discoveryservice.c b/lib/src/discoveryservice.c new file mode 100644 index 0000000..1105580 --- /dev/null +++ b/lib/src/discoveryservice.c @@ -0,0 +1,28 @@ +/* + * This file is part of Chiaki. + * + * Chiaki is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Chiaki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chiaki. If not, see . + */ + +#include + +CHIAKI_EXPORT ChiakiErrorCode chiaki_discovery_service_init(ChiakiDiscoveryService *service, ChiakiLog *log, sa_family_t family) +{ + return chiaki_discovery_init(&service->discovery, log, family); +} + +CHIAKI_EXPORT void chiaki_discovery_service_fini(ChiakiDiscoveryService *service) +{ + chiaki_discovery_fini(&service->discovery); +}