summaryrefslogtreecommitdiff
path: root/modules/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/main.cc')
-rw-r--r--modules/main.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/main.cc b/modules/main.cc
new file mode 100644
index 0000000..86e9c36
--- /dev/null
+++ b/modules/main.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021-2022 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <assert.h>
+
+#include "Module.h"
+#include "aitt_internal_definitions.h"
+
+extern "C" {
+
+// Function name Should be same with aitt::AittTransport::MODULE_ENTRY_NAME
+API void *aitt_module_entry(const char *ip, AittDiscovery &discovery)
+{
+ assert(!strcmp(__func__, aitt::AittTransport::MODULE_ENTRY_NAME)
+ && "Entry point name is not matched");
+
+ std::string ip_address(ip);
+ Module *module = new Module(ip_address, discovery);
+
+ AittTransport *tModule = dynamic_cast<AittTransport *>(module);
+ // NOTE:
+ // validate that the module creates valid object (which inherits AittTransport)
+ assert(tModule && "Transport Module is not created");
+
+ return tModule;
+}
+
+} // extern "C"