From 240625f9b7b47ce66dcdd41608ceea0a176cf230 Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net> Date: Sat, 8 Sep 2018 19:06:28 +0700 Subject: [PATCH] [+] Node operations --- dap_chain_net_node.c | 23 +++++++++++++++++++++++ dap_chain_net_node.h | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 dap_chain_net_node.c create mode 100644 dap_chain_net_node.h diff --git a/dap_chain_net_node.c b/dap_chain_net_node.c new file mode 100644 index 0000000000..216b750f11 --- /dev/null +++ b/dap_chain_net_node.c @@ -0,0 +1,23 @@ +/* + * Authors: + * Dmitriy A. Gearasimov <naeper@demlabs.net> + * DeM Labs Inc. https://demlabs.net + + 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 "dap_chain_node.h" + diff --git a/dap_chain_net_node.h b/dap_chain_net_node.h new file mode 100644 index 0000000000..37f73f8da5 --- /dev/null +++ b/dap_chain_net_node.h @@ -0,0 +1,40 @@ +/* + * Authors: + * Dmitriy A. Gearasimov <naeper@demlabs.net> + * DeM Labs Inc. https://demlabs.net + + 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 <stdint.h> +#include <stddef.h> +#include <sys/socket.h> +#include <netinet/in.h> + +typedef union dap_chain_node_addr{ + uint64_t addr_raw; + uint8_t addr_oct[sizeof(uint64_t)]; // Access to selected octects +} dap_chain_node_addr_t; + +typedef struct dap_chain_node{ + dap_chain_node_addr_t addr; + dap_chain_node_addr_t *uplinks; + dap_chain_node_addr_t *downlinks; + struct in_addr *ipv4_addrs; + struct in6_addr *ipv6_addrs; +} dap_chain_node_t; -- GitLab