From 44cb4c233e7f86e942e84780f1ec66af1509dbf6 Mon Sep 17 00:00:00 2001
From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net>
Date: Sat, 8 Sep 2018 18:46:32 +0700
Subject: [PATCH] [*] Net service common functions

---
 dap_chain_net_srv.c | 88 +++++++++++++++++++++++++++++++++++++++++++++
 dap_chain_net_srv.h | 45 +++++++++++++++++++++++
 2 files changed, 133 insertions(+)
 create mode 100644 dap_chain_net_srv.c
 create mode 100644 dap_chain_net_srv.h

diff --git a/dap_chain_net_srv.c b/dap_chain_net_srv.c
new file mode 100644
index 0000000..79e9ea1
--- /dev/null
+++ b/dap_chain_net_srv.c
@@ -0,0 +1,88 @@
+/*
+ * Authors:
+ * Dmitriy A. Gearasimov <kahovski@gmail.com>
+ * DeM Labs Inc.   https://demlabs.net
+ * DeM Labs Open source community https://github.com/demlabsinc
+ * Copyright  (c) 2017-2018
+ * All rights reserved.
+
+ This file is part of DAP (Deus Applications Prototypes) the open source project
+
+    DAP (Deus Applicaions Prototypes) 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.
+
+    DAP 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 any DAP based project.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "utlist.h"
+
+#include "dap_chain_srv.h"
+
+#define LOG_TAG "chain_srv"
+
+size_t m_uid_count;
+dap_chain_srv_uid_t * m_uid;
+
+/**
+ * @brief dap_chain_srv_init
+ * @return
+ */
+int dap_chain_srv_init()
+{
+    m_uid = NULL;
+    m_uid_count = NULL;
+    return 0;
+}
+
+/**
+ * @brief dap_chain_srv_deinit
+ */
+void dap_chain_srv_deinit()
+{
+
+}
+
+/**
+ * @brief dap_chain_srv_add
+ * @param a_srv
+ */
+void dap_chain_srv_add(dap_chain_srv_t * a_srv)
+{
+
+}
+
+/**
+ * @brief dap_chain_srv_get
+ * @param a_uid
+ * @return
+ */
+dap_chain_srv_t * dap_chain_srv_get( dap_chain_srv_uid_t a_uid)
+{
+
+}
+
+/**
+ * @brief dap_chain_srv_count
+ * @return
+ */
+const size_t dap_chain_srv_count()
+{
+
+}
+
+/**
+ * @brief dap_chain_srv_list
+ * @return
+ */
+const dap_chain_srv_uid_t * dap_chain_srv_list()
+{
+
+}
diff --git a/dap_chain_net_srv.h b/dap_chain_net_srv.h
new file mode 100644
index 0000000..780be5f
--- /dev/null
+++ b/dap_chain_net_srv.h
@@ -0,0 +1,45 @@
+/*
+ * Authors:
+ * Dmitriy A. Gearasimov <kahovski@gmail.com>
+ * DeM Labs Inc.   https://demlabs.net
+ * DeM Labs Open source community https://github.com/demlabsinc
+ * Copyright  (c) 2017-2018
+ * All rights reserved.
+
+ This file is part of DAP (Deus Applications Prototypes) the open source project
+
+    DAP (Deus Applicaions Prototypes) 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.
+
+    DAP 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 any DAP based project.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#pragma once
+
+#include "dap_chain_node.h"
+#include "dap_chain_srv_pkt.h"
+
+typedef struct dap_chain_srv
+{
+    dap_chain_node_t * node;
+    dap_chain_srv_uid_t uid; // Unique ID for service.
+
+    void * _internal;
+    void * _inhertor;
+} dap_chain_srv_t;
+
+int dap_chain_srv_init();
+void dap_chain_srv_deinit();
+
+void dap_chain_srv_add(dap_chain_srv_t * a_srv);
+dap_chain_srv_t * dap_chain_srv_get( dap_chain_srv_uid_t a_uid);
+const size_t dap_chain_srv_count();
+const dap_chain_srv_uid_t * dap_chain_srv_list();
+
-- 
GitLab