diff --git a/dap_chain_net_srv.c b/dap_chain_net_srv.c index 54fa3fa8eeb3fc7e47f4fef6677ef0b62bdc756f..f1fec03525986c2ee729e08ce06eda3ff3b250c2 100755 --- a/dap_chain_net_srv.c +++ b/dap_chain_net_srv.c @@ -8,19 +8,19 @@ 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/>. -*/ + 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" @@ -39,6 +39,7 @@ int dap_chain_net_srv_init() { m_uid = NULL; m_uid_count = 0; + return 0; } @@ -64,7 +65,7 @@ void dap_chain_net_srv_add(dap_chain_net_srv_t * a_srv) * @param a_uid * @return */ -dap_chain_net_srv_t * dap_chain_net_srv_get( dap_chain_net_srv_uid_t a_uid) +dap_chain_net_srv_t * dap_chain_net_srv_get(dap_chain_net_srv_uid_t a_uid) { } diff --git a/dap_chain_net_srv.h b/dap_chain_net_srv.h index fbfc58b99b5448a387b3f6386549e3d107a5f9f4..bd9c5ea57793f146197556ce5f16e2c569147836 100755 --- a/dap_chain_net_srv.h +++ b/dap_chain_net_srv.h @@ -8,24 +8,35 @@ 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/>. -*/ + 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_ctl.h" #include "dap_chain_net_srv_common.h" +//Classes of services +enum { + SERV_CLASS_ONCE = 1, // one-time service + SERV_CLASS_PERMANENT = 2 +}; + +//Types of services +enum { + SERV_ID_VPN = 1, +}; + typedef struct dap_chain_net_srv { dap_chain_node_ctl_t * node; @@ -35,11 +46,33 @@ typedef struct dap_chain_net_srv void * _inhertor; } dap_chain_net_srv_t; +typedef struct dap_chain_net_srv_abstract +{ + uint64_t proposal_id; // id trade proposal. Must be unique to the node. + + uint8_t class; //Class of service + uint8_t type_id; //Type of service + union { + struct { + int bandwith; + int abuse_resistant; + int limit_bytes; + } vpn; + struct { + int value; + } other_srv; + } proposal_params; + + uint64_t price; // service price, for SERV_CLASS_ONCE ONCE for the whole service, for SERV_CLASS_PERMANENT for one unit. + uint8_t price_units; // Unit of service (seconds, megabytes, etc.) Only for SERV_CLASS_PERMANENT + char decription[128]; +} DAP_ALIGN_PACKED dap_chain_net_srv_abstract_t; + int dap_chain_net_srv_init(); void dap_chain_net_srv_deinit(); void dap_chain_net_srv_add(dap_chain_net_srv_t * a_srv); -dap_chain_net_srv_t * dap_chain_net_srv_get( dap_chain_net_srv_uid_t a_uid); +dap_chain_net_srv_t * dap_chain_net_srv_get(dap_chain_net_srv_uid_t a_uid); const size_t dap_chain_net_srv_count(); const dap_chain_net_srv_uid_t * dap_chain_net_srv_list();